[Python-Dev] comprehension abbreviation (was: Adding any() and all())

Neil Hodgson nyamatongwe at gmail.com
Mon Mar 14 00:12:09 CET 2005

Guido van Rossum:

> - Before anybody asks, I really do think the reason this is requested
> at all is really just to save typing; there isn't the "avoid double
> evaluation" argument that helped acceptance for assignment operators
> (+= etc.), and I find redability is actually improved with 'for'.

   For me, the main motivation is to drop an unnecessarily repeated
identifier. If you repeat something there is a chance that one of the
occurrances will be wrong which is one reason behind the Don't Repeat
Yourself principle. The reader can more readily see that this is a
filter expression rather than a transforming expression.


More information about the Python-Dev mailing list