comprehensions was Re: Switch statements again

Erik Max Francis max at alcyone.com
Fri Jan 17 20:00:02 EST 2003


Tim Peters wrote:

> That's right, and is really all there is to it.  Guido wanted
> 
>     [f(x) for x in whatever]
> 
> to act "exactly like"
> 
>     result = []
>     for x in whatever:
>         result.append(f(x))

Note that I carefully noticed this behavior and followed the pattern in
EmPy as well:

max at oxygen:~/projects/empy% ./em.py 
@[for i in range(10):@i, ]
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
@i
9

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ There are defeats more triumphant than victories.
\__/ Montaigne
    ZOE / http://www.alcyone.com/pyos/zoe/
 A simple Python OpenGL rendering engine.




More information about the Python-list mailing list