list() coercion

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Wed Jul 16 23:04:02 EDT 2003


Ian Bicking wrote:
> However, list() seems to call the object's
> __len__, 
 >
> Is there a way I can keep this from happening?

Give your object an __iter__ method that returns
itself.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list