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

Alex Martelli aleaxit at yahoo.com
Mon Mar 14 13:09:12 CET 2005

On Mar 14, 2005, at 10:57, Gareth McCaughan wrote:

>     of way as it's distracting in C or C++ seeing
>         Thing thing = new Thing();
>     with the type name appearing three times.

I think you can't possibly see this in C:-), you need a star there in 
C++, and you need to avoid the 'new' (just calling Thing() should do it 
-- maybe you're commixing with Java?), but still, I do agree it looks 
uncool... no doubt a subtle ploy by Java and C++ designers to have you 
use, instead, the preferable interface-and-factory idioms such as:

IThing thing* = thingFactory();

rather than declaring and instantiating concrete classes, which is just 
_so_ three years ago;-)

Back to the Python world, I don't particularly love [x for x in ...] by 
any means, but I surely hope we're not tweaking the syntax for such 
tiny gains in the 2.4 -> 2.5 transition.  Wasn't 2.5 "supposed to be" 
mostly about standard library reorganizations, enhancements, etc?  Were 
there some MAJOR gains to be had in syntax additions, guess that could 
be bent, but snipping the [<name> for ...] leading part seems just such 
a tiny issue.  (If the discussion is about 3.0, and I missed the 
indication of that, I apologize).


More information about the Python-Dev mailing list