On Sat, Apr 11, 2015 at 3:21 PM, Steven D'Aprano <st...@pearwood.info> wrote: > On Sun, Apr 12, 2015 at 05:09:43AM +1000, Steven D'Aprano wrote: > >> Almost correct, but not quite. range, like xrange in Python 2, is not a >> generator, but a custom-made lazy sequence object. >> >> py> gen() # This actually is a generator. >> <generator object gen at 0xb7bd7914> >> py> range(1, 10) # This is not. >> range(1, 10) > > Oops, I forgot to show where gen() came from. Sorry about that, just a > cut-and-paste error. > > py> def gen(): > ... yield 1 > ... > py> gen() # This actually is a generator. > <generator object gen at 0xb7bd7914> > Thanks for the tip Steve > > > -- > Steve > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor
-- Joel Goldstick http://joelgoldstick.com _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor