Ben Finney <ben+pyt...@benfinney.id.au> writes: > Arnaud Delobelle <arno...@googlemail.com> writes: > >> What about >> foo = iter('') > > That doesn't return a generator. > > >>> foo = iter('') > >>> foo > <listiterator object at 0xf7cd3ed0> > > Whether the OP needs to create a generator, or just any iterable type, > isn't clear.
If it walks and quacks like a duck... Anyway it's not just an iterable object, it's an iterator. I can't really imagine that there would be some code which would be happy with generators but not with iterators (as long as you can't send anything to them, which is always the case with an empty generator). -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list