Classes: Old or New and How?

Dimitris Garanatsios rs96057 at hotmail.com
Tue Apr 23 01:47:18 EDT 2002


"Philip Swartzleonard" <starx at pacbell.net> wrote in message
news:Xns91F8BDF3CF983RASXnewsDFE1 at 130.133.1.4...
>     I've been using py2.2 for a while now, although i haven't really
> used many of the new features aside from the odd list compt to ease
> initing 2-3 dimensional lists, and some class hierarchy i made off list
> some months ago. (No generators or anything like that).
>     What i'm wondering is this: when i define some random class,
> weather it's something small (initially) like a Link_Node (datastructures
> class =) or a GL_Color, or something way comlicated like ARCS_FOV or a
> game world controller, in anycase they don't require any special
> functionality -- just data and regular methods. When i start a class like
> this, should I bother explicetly deriving from Object, or should I set
> that flag that makes everything like that, or should I just not bother?
>
> Thanks.
>
> --
> Philip Sw "Starweaver" [rasx] :: www.rubydragon.com

It doesn't matter whether you use "object " as a base class/type or not in
Python 2.2. Old-style classes still work as well and (for the moment) you
are free to choose between styles any time you create a class. Using the new
style should not make any difference from the class beeing used the
old-style way, though it offers some interesting options...

I think that, new style is some kind of an extension of the old one and that
in later versions of Python the default style will change to the new (maybe
a unified one).

Dimitris








More information about the Python-list mailing list