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

Gareth McCaughan gmccaughan at synaptics-uk.com
Mon Mar 14 14:20:10 CET 2005

On Monday 2005-03-14 12:09, Alex Martelli wrote:
> 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:

Er, sorry about the various slips of detail. And I don't even
use Java. Bah! (But it looks even worse without the "new"

> 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).

When I say I'd like it, I don't mean "we should change it now",
only that it would be nice for it to be there. Stability matters
more than optimality sometimes, and now may well be such a time.


More information about the Python-Dev mailing list