What makes an iterator an iterator?
bbxx789_05ss at yahoo.com
Thu Apr 19 23:39:48 CEST 2007
On Apr 19, 3:12 pm, 7stud <bbxx789_0... at yahoo.com> wrote:
> On Apr 19, 5:37 am, Steve Holden <s... at holdenweb.com> wrote:
> > It's nothing to do with the name lookup. Alex mentioned that to remind
> > us that the magic "double-under" names are looked up on the type rather
> > than the instance...
> Where is the "double-under" name?
The following example looks up next() in the instance not the class:
self.next = lambda: "hello"
p = Parrot()
_t = iter(p)
More information about the Python-list