recognizing empty iterators
Michele Simionato
mis6 at pitt.edu
Tue Jul 22 11:44:52 EDT 2003
Steven Taschuk <staschuk at telusplanet.net> wrote in message news:<mailman.1058835583.22488.python-list at python.org>...
> Quoth Michele Simionato:
> > [...] In other words I am looking for an
> > "isempty" function to use in "if" statements such as
> >
> > if isempty(iterator):
> > do_something()
> >
> > without side effects. [...]
>
> I don't have anything substantial to add to others' posts, but I
> wonder: under what circumstances do you want to do this?
I wanted to check the output of ifilter or imap; at the end I solved
my problem in another way, nevertheless I am surprised there is no
way to check for an empty iterator in current Python, it seems to be
a quite legitimate question, isn't it?
Michele
More information about the Python-list
mailing list