[Python-Dev] Small any/all enhancement

Valentino Volonghi aka Dialtone dialtone at divmod.com
Tue Dec 27 23:48:35 CET 2005


On Tue, Dec 27, 2005 at 01:50:37PM -0800, Alex Martelli wrote:

I'll answer here for all the people who kindly answered.

> Why would that be better than
> any(o.some_attribute for o in some_objects)
> ?

I think it's because lately I've been using common lisp a lot and the approach
with the test function is pretty common there.

Of course I already knew all the alternatives using map and the generator
expression, but I felt like mine was clearer for a reader, this is probably
true but not enough to justify the change.

One reason was to hide the iteration from the user and let python handle
it, but I can see that this is both not enough and probably not even so
necessary since the iteration protocol is already 'hidden' when using for..in.

> What am I missing?

Nothing, it's just me and the bad influence that lisp has on my mind :).
Sorry to bother the list then. Thanks for the kind replies.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20051227/ffc6dadd/attachment.pgp


More information about the Python-Dev mailing list