Conditionally implementing __iter__ in new style classes

infidel saint.infidel at gmail.com
Wed Jul 6 12:17:23 EDT 2005


Why not define an Iterator method in your Base class that does the
iteration using __getitem__, and any subclass that wants to do
something else just defines its own Iterator method?  For that matter,
you could just use the __iter__ methods of Base and Concrete instead of
a separate method.




More information about the Python-list mailing list