On Fri, 2006-03-24 at 07:26 -0800, Guido van Rossum wrote:
> On 3/24/06, Barry Warsaw <[EMAIL PROTECTED]> wrote:
> > On Thu, 2006-03-23 at 17:06 -0800, Guido van Rossum wrote:
> >
> > > The pattern with the 'empty' flag is only needed when due to API
> > > constraints you have only got an iterator.
> >
> > Which can happen quite often actually.  Perhaps making the original
> > object available as an attribute of the iterator can help in those
> > situations though.
> 
> It can't work, at least not in general. How do you do this if the
> iterator is a generator? Or an infinite sequence? Or a filter? It
> can't be made part of the iterator protocol. You can design your own
> extension of the iterator protocol, but then it wouldn't accept
> arbitrary iterators any more.

Yes, absolutely true.  I wasn't really proposing a change to the generic
iterator protocol, just suggestion something "one" could do if "one"
needed that functionality (although an agreed upon convention would make
it somewhat more general).

-Barry

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to