Enumming

Alex Martelli alex at magenta.com
Tue Aug 22 03:54:13 EDT 2000


"John W. Baxter" <jwbnews at scandaroon.com> wrote in message
news:jwbnews-399BFD.16352321082000 at news.olympus.net...
    [snip]
> enough, and you'll think "*again?".  Starting with Python 1.6, we can say
> myList.append( (functionA(), funcationB(), functionC(),
> functionD(),functionD()) )

You can say this in Python 1.5.2 as well.

> But unfortunately that's not friendly now: it appends the tuple as one
> item:

Not sure why you claim this is 'not friendly': it's *exactly* what I
would expect.  How else WOULD I append a tuple-as-one-item, otherwise?!

Do you mean it STOPS working this way in 1.6...?  It doesn't seem
to be broken in 1.6b1.  What am I missing?


> To work with 1.5.2 and 1.6, the loop would need to be something like
>
>      for i in range( 10 ):
>         myList.append( functionA() )
>         myList.append( functionB() )
>         myList.append( functionC() )
>         myList.append( functionD() )
>         myList.append( functionE() )

Eep!  Why not just:
    myList.extend([functionA(), functionB(),
etc?


Alex






More information about the Python-list mailing list