itertools suggestion
Jimmy Retzlaff
jimmy at retzlaff.com
Sat Feb 22 13:35:55 EST 2003
Magnus Lie Hetland (mlh at furu.idi.ntnu.no) wrote:
>Some things that might be useful (with rather arbitrary names)
>
> iatom(foo) -- an iterator that returns foo
> iappend(it, foo) -- an iterator that exhausts it and then returns
> foo
>
>The latter could, of course, be achieved with
>
> chain(it, iatom(foo))
>
>if chain is adopted. (Odd that it is documented but not included... :)
...
>Just a thought, though -- I'm sure there are other ways of doing this
that
>may be prettier...
I would think [foo] would do as well as iatom(foo). If so, then I think
chain(it, [foo]) would make iappend unnecessary.
Jimmy
More information about the Python-list
mailing list