[Python-Dev] List comprehensions
Skip Montanaro
skip@pobox.com
Wed, 26 Jun 2002 16:57:53 -0500
Jerry> Has anyone summarized the list comprehension design discussions?
Jerry> I found references to "lots of discussion" about it but haven't
Jerry> yet found the discussions themselves.
Jerry,
I think list comprehensions were just about the last major feature to be
added to the language before PEPs became the absolute way to hash stuff out.
Here's a comment from Guido dated 2000-08-11:
Go for it! (This must be unique -- the PEP still hasn't been finished,
and the code is already accepted. :-)
Consequently, the PEP (202) never did really get fleshed out.
As I recall, it went something like:
1. Buncha discussion in c.l.py. Check out this thread begun by Greg
Ewing from August 1998:
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=35C7E33C.4B14%40cosc.canterbury.ac.nz&rnum=1&prev=/groups%3Fq%3Dg:thl4020484492d%26dq%3D%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3Dutf-8%26selm%3D35C7E33C.4B14%2540cosc.canterbury.ac.nz
With a little more agressive use of the time machine, Tim & Greg
could maybe have snuck them into 1.5.2!
2. Greg implemented them as a proof of concept and then they
languished.
3. I picked them up in mid-2000 and got the ball rolling on
getting them into 2.0.
4. They got accepted in August 2000.
The last couple steps happened while the 1.6/2.0/CNRI/BeOpen stuff was going
on, so I'm pretty sure no summary of the discussions took place. If you're
looking for a significant thread, I'd start in the python-dev archives
around April or May 2000. You might also want to check the comments in the
patch:
http://python.org/sf/400654
I don't believe the issue of variable scope ever came up until after 2.0 was
released. I certainly thought of them as just shorthand notation for for
loops. (Maybe it was discussed in the 1998 thread, but I'm not about to
read all 103 articles. ;-)
Skip