
April 30, 2009
11:46 p.m.
Tarek Ziadé schrieb:
On Thu, Apr 30, 2009 at 12:20 AM, Terry Reedy <tjreedy-noVtnmiAkQo@public.gmane.org> wrote:
hasattr(ob, '__iter__')
Right, that works under Python 3, (It won't cover str under Python 2 though)
The old-style iteration protocol (__getitem__ and __len__) has not disappeared in Python 3. It's just that str got its own iterator type. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.