Skip to content

Commit 5e808ca

Browse files
committed
src/sage/interfaces/maxima_abstract.py: clarify a comprehension
Using python's walrus operator we can simplify the list comprehension that builds the list of maxima _commands(). Essentially this allows us to save the result of foo.strip() and work with that rather than the original unstripped string foo.
1 parent b61a0ea commit 5e808ca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sage/interfaces/maxima_abstract.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,10 @@ def _commands(self):
344344
# with random leading spaces: ' tminverse', ' toeplitz', etc.
345345
#
346346
bad_chars = ("\\", "/", "?", "%")
347-
return [c.strip()
348-
for c in all_names
349-
if c
350-
and (c[0] in a_to_Z or c[0] == " ")
347+
return [c
348+
for n in all_names
349+
if (c := n.strip())
350+
and c[0] in a_to_Z
351351
and not any(bad in c for bad in bad_chars)]
352352

353353
def _tab_completion(self, verbose=True, use_disk_cache=True):

0 commit comments

Comments
 (0)