Guido van Rossum wrote: > On 11/18/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> (Although I will point out >> that most protocols for things like len() *do* involve checks for >> special >> methods by name, and the check for iterability is typically a >> non-destructive >> call to iter(x), rather than a destructive one to x.next()). > > Ouch?! I would never check for iterability explicitly. I would just > require it, as Greg Ewing says. iter() could be fairly expensive, > depending on what is being iterated over.
I didn't mean to imply that the call to iter() couldn't be an implicit one in a for loop/genexp/listcomp/itertool. As you say, the need to check explicitly is rare. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com