Recursive list comprehension
Terry Reedy
tjreedy at udel.edu
Wed Dec 8 22:25:27 EST 2004
More information about the Python-list mailing list
Wed Dec 8 22:25:27 EST 2004
- Previous message (by thread): Recursive list comprehension
- Next message (by thread): Recursive list comprehension
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Steven Bethard" <steven.bethard at gmail.com> wrote in message news:LoNtd.465310$wV.295778 at attbi_s54... > 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
- Previous message (by thread): Recursive list comprehension
- Next message (by thread): Recursive list comprehension
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list