Skip to content

Commit 9d8a4c5

Browse files
update docstring,
1 parent 612a6ff commit 9d8a4c5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pandas/core/computation/parsing.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@ def create_valid_python_identifier(name: str) -> str:
3535
------
3636
SyntaxError
3737
If the returned name is not a Python valid identifier, raise an exception.
38-
This can happen if the name includes characters that fall out of the range of
39-
(U+0001..U+007F).
4038
"""
4139
if name.isidentifier() and not iskeyword(name):
4240
return name
4341

4442
# Escape characters that fall outside the ASCII range (U+0001..U+007F).
4543
# GH 49633
46-
c_escaped_gen = (
47-
"".join(chr(b) for b in c.encode("ascii", "backslashreplace")) for c in name
44+
gen = (
45+
(c, "".join(chr(b) for b in c.encode("ascii", "backslashreplace")))
46+
for c in name
4847
)
4948
name = "".join(
5049
c_escaped.replace("\\", "_UNICODE_" if c != c_escaped else "_BACKSLASH_")
51-
for c, c_escaped in zip(name, c_escaped_gen)
50+
for c, c_escaped in gen
5251
)
5352

5453
# Create a dict with the special characters and their replacement string.

0 commit comments

Comments
 (0)