Steven D'Aprano <[email protected]> added the comment:
We're not mind-readers, how do you expect us to know what you tried if you
don't tell us?
The walrus operator works for me:
>>> [spam for c in "hello world" if (spam:=c.upper()) in 'AEIOU']
['E', 'O', 'O']
>>> [(spam:=x**2, spam+1) for x in range(5)]
[(0, 1), (1, 2), (4, 5), (9, 10), (16, 17)]
What did you try, and what happened?
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38556>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com