Why is there no instancemethod builtin?

Michele Simionato michele.simionato at gmail.com
Sun Jun 19 13:35:46 EDT 2005


I think strings do not have __iter__ on purpose, exactly to distinguish
them
from other iterables, since sometimes it is nice to consider them
atomic,
but I am not sure of this. You should ask the developers. Anyway, the
right definition of iterable is (as I was told) "an object X such that
iter(X)
does not throw an exception". Objects following the __getitem__
protocol
- such as strings -are iterables even if they do not have an __iter__
method.


           Michele Simionato




More information about the Python-list mailing list