mrquantum wrote: > Am Wed, 04 Oct 2006 12:03:41 +0200 schrieb Fredrik Lundh:
>> really? iter("SomeString") works just fine for me. > But then why doesn't dir('SomeString') show an __iter__ method? Seems to > be implmented differently than with e.g. lists? The older pre-__iter__() iteration style relying on __getitem__() still works: >>> class A: ... def __getitem__(self, index): ... return [3,2,1][index] ... >>> for item in A(): ... print item ... 3 2 1 > Know why? No idea. Perhaps nobody cared? Peter -- http://mail.python.org/mailman/listinfo/python-list