my own type in C, sequence protocol

Alex Martelli aleaxit at yahoo.com
Thu Sep 9 18:20:25 EDT 2004


Grant Edwards <grante at visi.com> wrote:
   ...
> If you want to iterate over your object, you probably want to
> support the sequence protocol.

In general, supplying a suitable __iter__ method is simpler and more
suitable than implementing the sequence protocol, if your purpose is to
allow iteration on an object.


Alex



More information about the Python-list mailing list