Classes and Python
Lawrence Oluyede
rhymes at myself.com
Thu Jan 24 11:39:11 EST 2002
On 24 Jan 2002 08:34:28 -0800, aahz at panix.com (Aahz Maruch) wrote:
>The real meaning is that if you're using the current Python 2.2, it's
>wrong. ;-)
So, the tut is obsolete?
>But it's probably still worthwhile to explain it:
>
>Let's suppose you create a list with
>
>>>> L=[]
>>>> L
>[]
>
>now you can add a new element to L with
>
>>>> L.append('foo')
>>>> L
>['foo']
>
>this means that L has object-like behavior, in that there are methods
>that can be used. But you cannot subclass from the list type in
>versions of Python prior to 2.2 -- this is called the type/class split.
>Python 2.2 takes the first steps to heal the type/class split, and you
>*can* now inherit from the list type.
Can u make a useful example with List subclassing?
--
Lawrence "Rhymes" Oluyede (rhymes at myself.com)
"Per cambiare, per diventare un'altra
cosa dobbiamo prima sapere cosa siamo"
(Bruce Lee)
More information about the Python-list
mailing list