Walter Dörwald wrote:

> I don't know about __call__, but str and unicode don't have __iter__,
> list, tuple and dict do:

That's probably because str and unicode don't do their
own iteration, but rely on the fallback implementation.
In which case it's perfectly correct for them not to
have an __iter__ method.

If you want to test whether something is iterable, it's
not enough to test for __iter__ -- you also need to
test for __len__ and __getitem__ as an alternative.
Which means it might make sense to have an iterable()
function which does that.

--
Greg
_______________________________________________
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

Reply via email to