Re: [Tutor] New Style Classes, __getitem__ and iteration

2008-05-19 Thread Kent Johnson
On Mon, May 19, 2008 at 5:21 PM, Marilyn Davis <[EMAIL PROTECTED]> wrote: > Hi Tutors and Tutees, > > I've been teaching Python quite a while and a brilliant student asked a > question that made me realize a big hole in my understanding. > > I think it is really magical that, when I define __getite

Re: [Tutor] New Style Classes, __getitem__ and iteration

2008-05-19 Thread wesley chun
> I think it is really magical that, when I define __getitem__ on classic > classes, the built-in iterator uses it. > > But, when I make the same class as a new style class, I lose this behavior. > > I didn't realize that something was lost in defining a new style class. > Maybe it's something

[Tutor] New Style Classes, __getitem__ and iteration

2008-05-19 Thread Marilyn Davis
Hi Tutors and Tutees, I've been teaching Python quite a while and a brilliant student asked a question that made me realize a big hole in my understanding. I think it is really magical that, when I define __getitem__ on classic classes, the built-in iterator uses it. But, when I make the same cl