lists....order...

Erik Max Francis max at alcyone.com
Thu Oct 10 05:25:31 CEST 2002


Mark McEahern wrote:

> $ python2.3
> Python 2.3a0 (#1, Oct  9 2002, 21:35:16)  #<-- Yup, just installed it.
> [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import string
> >>> for i, letter in enumerate(string.letters):
> ...     print "%d --> %s" % (i, letter)
> ...

I was going to do the same thing out of curiosity, so you saved me some
time.

That's a really useful construct; the fact that it's a builtin means
that it has the opportunity to be quite efficient, as opposed to the
Pythonic-but-awkward zip(S, range(len(S))) pattern.  I'm glad that's the
kind of thing that's being added to new versions; it's elegant and
useful.

Are bools going to be in 2.3 as well?

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Freedom is a road seldom travelled by the multitudes
\__/ Public Enemy
    The laws list / http://www.alcyone.com/max/physics/laws/
 Laws, rules, principles, effects, paradoxes, etc. in physics.



More information about the Python-list mailing list