python gripes survey

Ryan Lowe ryanlowe0 at msn.com
Sun Aug 24 21:01:52 EDT 2003


"Patrick Lioi" <patrick at novaroot.com> wrote in message
news:2a82921f.0308241641.5bf82d6d at posting.google.com...
> I would like to see a shorthand for list.append(), borrowed from PHP:
>
> foo = [1, 2, 3]
> foo[] = 4  # foo now equals [1, 2, 3, 4]

well, you can just concatenate a list like this:

>>> foo += [4]

the meaning of this is even clearer i think.

> I would also like to see what would probably end up being called
> "generator comprehensions".  That is definitely not my own idea, but
> for the life of me I can't remember where I first heard about it.
> Imagine being able to throw the yield keyword into a list
> comprehension syntax in order to take advantage of list
> comprehension's in a memory-efficient way, something kinda like this:
>
> foo = [yield i*i for i in xrange(100)]

i like this idea too. someone wrote a PEP for it:

http://www.python.org/peps/pep-0289.html

but alas it was rejected, like so many good ideas 'round here ;^)










More information about the Python-list mailing list