"Steven Bethard" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> What is the getnext protocol?  Is that the same thing that the iter() 
> docs call the sequence protocol?

Yes. (I meant to write getitem rather than getnext.)

>  Because this definitely still works with itertools:

Yes, not because itertools are cognizant of sequence objects but because 
itertools apply iter() to inputs and because iter() currently accomodates 
sequence-protocol objects as well as iterable-protocol objects by wrapping 
the former with builtin <iterator> objects.  I expect that may change if 
and when the builtin C-coded types are updated to have __init__ methods. 
This is a ways off, if ever, but I think the general advice for user code 
is to use the newer protocol.  So, for the purpose of writing new code, I 
think it justified to forget about or at least ignore the older iteration 
protocol.

Terry J. Reedy




-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to