Skip to content

Commit c3157b3

Browse files
committed
Simplified and pythonified loop comparisons
1 parent ea6c8a6 commit c3157b3

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

emacs-the-best-python-editor/PyEval/pyeval_expression.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,7 @@ def parse(self):
105105
current_char = self.__expr_string[self.__current_position]
106106

107107
# Now we loop for as long as we have numbers
108-
while current_char in [
109-
"0",
110-
"1",
111-
"2",
112-
"3",
113-
"4",
114-
"5",
115-
"6",
116-
"7",
117-
"8",
118-
"9",
119-
]:
108+
while current_char in "0123456789":
120109
current_token += current_char
121110
self.__current_position += 1
122111
current_char = self.__expr_string[self.__current_position]
@@ -132,7 +121,7 @@ def parse(self):
132121
# Here, we just need a single operator, so
133122
# Get that operator, validate it, then
134123
# Create a new operator object
135-
if current_char not in ["+", "-", "*", "/", "%", "^"]:
124+
if current_char not in "+-*/%^":
136125
raise SyntaxError
137126

138127
current_operator = Operator(current_char)

0 commit comments

Comments
 (0)