Do this as a list comprehension?

Mensanator mensanator at aol.com
Mon Jun 9 01:53:15 EDT 2008


On Jun 8, 9:40 pm, John Salerno <johnj... at gmailNOSPAM.com> wrote:
> Mensanator wrote:
> > On Jun 8, 3:19�am, "Terry Reedy" <tjre... at udel.edu> wrote:
> >> "Mensanator" <mensana... at aol.com> wrote in message
>
> >>news:8d7c0912-422f-4480-a034-078f9dbcae24 at 2g2000hsn.googlegroups.com...
> >> | On Jun 7, 6:43?pm, "Terry Reedy" <tjre... at udel.edu> wrote:
> >> | > zip(range(9,2000000000), iterable)
> >> |
> >> | Oh, dear. You didn't actually try this, did you?
>
> >> Works fine in Py3, which is what I use now.
>
> > You really ARE cruel to the newbies, aren't you?
>
> > Don't you think it would have been appropriate
> > to attach a large red label: WARNING! PY3!
>
> Heh heh, don't worry. Every time I see a range function, I immediately
> think "creates a list". Not sure how I got into that habit, but it
> happens every time! :)

You probably got into that habit because that's
what it does in 2.x, create a list. Now, if
you're expecting that to happen you'll in for
a surprise when you switch to Py3, won't you?




More information about the Python-list mailing list