Re: [Tutor] subclass question

2009-12-21 Thread bob gailer
David Perlman wrote: If I make a subclass of a built-in class, like this: class mylist(list): def __init__(self): list.__init__(self) Then it is valid for me to do this: >>> x=mylist() >>> x.hello=3 >>> But I can't do this: >>> y=list() >>> y.hello=3 Traceback (most recent call l

Re: [Tutor] subclass question

2009-12-20 Thread Rich Lovely
2009/12/20 David Perlman : > If I make a subclass of a built-in class, like this: > > class mylist(list): >    def __init__(self): >        list.__init__(self) > > Then it is valid for me to do this: > x=mylist() x.hello=3 > > But I can't do this: > y=list() y.hello=3 > Tra

[Tutor] subclass question

2009-12-19 Thread David Perlman
If I make a subclass of a built-in class, like this: class mylist(list): def __init__(self): list.__init__(self) Then it is valid for me to do this: >>> x=mylist() >>> x.hello=3 >>> But I can't do this: >>> y=list() >>> y.hello=3 Traceback (most recent call last): File "", line