What about an EXPLICIT naming scheme for built-ins?

Anna Martelli Ravenscroft anna at aleax.it
Tue Sep 7 16:04:57 EDT 2004


Alex Martelli wrote:

> Carlos Ribeiro <carribeiro at gmail.com> wrote:
>    ...
> 
>>first time -- it's obvious once you see it, but still, for some
>>reason, the list comprehension was more intuitive for me. I don't know
>>about the rest of Pythoneers, specially newbies, but understanding
>>*why* did I came up with my version may help to illustrate the mental
>>model surrounding iterators.
> 
> 
> I dunno either, but, FWIW, my wife Anna also had the same issue -- she
> thought list comprehensions were always the right way to make lists.
> 
> It may have to do with the issue that list comprehension are a neat
> GENERAL tool, while calling list, like calling, say, map or filter, may
> be concise, clear and efficient but only works in specific cases.  Just
> a guess on my part, but it seems a reasonable hypothesis.  Anna, do you
> have any opinion in the matter?

I *guess* I had thought of it, if at all, as something similar to 
int('2') or float(2). They're useful, but only in very limited specific 
cases. I would have expected list('cat') to force a list out of the 
string. Just like int() or float() and, well, that's it. That's as far 
as I would have thought of it as being useful...

Seeing you use it the other way, was a surprise.

Anna



More information about the Python-list mailing list