[Python-Dev] PEP 572: Assignment Expressions

Matěj Cepl mcepl at cepl.eu
Sat Apr 21 13:53:42 EDT 2018


On 2018-04-21, 07:46 GMT, Chris Angelico wrote:
> doubled_items = [x for x in (items := get_items()) if x * 2 in 
> items]

Aside from other concerns expressed elsewhere by other people, 
do you really like this? I know and agree that “readability” is 
a subjective term, but it is my firm persuasion that whenever 
I need to think about what particular list comprehension means, 
it is the moment I should write a separate function or normal 
cycle. I think we should encourage writing simple (I didn’t use 
the r* word here, you see!) code than something which has 
potential to slide us towards Perl.

Best,

Matěj
-- 
https://matej.ceplovi.cz/blog/, Jabber: mcepl at ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
A day without sunshine is like night.



More information about the Python-Dev mailing list