[Tutor] Re: How to subclass built-in types?

Gregor Lingl glingl@aon.at
Sun, 29 Sep 2002 19:07:21 +0200


Derrick 'dman' Hudson schrieb:

> 
>| >>> class N(list):
>|    def __init__(self, seq, x):
>|        self.x = x
>         list.__init__( self , seq )
>        #^^^^ superclass object
>
>| Who knows how to do it "according to the rules"?
>
>It's the same as for non-builtin types.  (note: python >= 2.2 must be
>used to subclass built-in types)
>
>-D
>
>  
>
Many thanks, that was it! How simple! (Should have done a look at 
dir(list)).
Gregor