Re: Are all classes new-style classes in 2.4+?



Isaac Rodriguez wrote:
I declare property members in both and it seems to work the exact same
way. I am using Python 2.4, and I was wondering if by default, all
classes are assumed to be derived from "object".

No, they are not. It's just that the "basic functionality" seems to work
the same at first glance (i.e. you don't need to learn alot of new
syntax in order to switch from old-style to new-style classes).

Play around with things like dir() and type() on old-style and new-style
classes, and you will soon see differences.

If not, can someone
point me to some place where I can learn more about new-style classes
and their advantages? All the documentation I've found is very vague.

http://www.python.org/download/releases/2.2.3/descrintro/
http://www.cafepy.com/article/python_types_and_objects/python_types_and_objects.html

--
René
OpenPGP key id: 0x63B1F5DB
JID: rene.fleschenberg@xxxxxxxxxxxxx

Attachment: signature.asc
Description: OpenPGP digital signature



Relevant Pages

  • Re: Problem with operator overloading and inheritance in Python
    ... How do I define new-style classes? ... I neglected to consider that you might be using old-style ... instance type, where as new-style classes actually give yuou the class ...
    (comp.lang.python)
  • Re: less obvious "super"
    ... using the legacy object-model of Python < 2.2. ... The second one creates a 'new-style' class using the new (well... ... since Python 2.2, which is not that new) and far more powerfull object model. ...
    (comp.lang.python)
  • Re: DBD driver has not implemented the AutoCommit attribute ...
    ... I used the old-style connect as follows; ... But then I also had to comment out the carp in the connect routine in ... I also tried to undef the AutoCommit attribute while using the ... new-style connect but I'm sure you already know what happened when I ...
    (perl.dbi.users)