On Sun, 25 Sep 2005 15:24:29 +0200, Gerrit Holl wrote
(in article <[EMAIL PROTECTED]>):
> I like this. However, perhaps other people reading my source code won't
> like it, because when they see 'class Foo:', they might expect an
> old-style class. But it's so much better to type and to read, that
Diez B. Roggisch wrote:
> > What is the reason for allowing both styles? (backwards compatibility??)
>
> yes.
Note that there is another way to create new-style classes:
__metaclass__ = type
before the first class definition:
>>> class Foo: pass
...
>>> type(Foo)
>>> __metaclass__ = type
>>>
> What is the reason for allowing both styles? (backwards compatibility??)
yes.
>
> When I make my own classes should they always be new-style objects or are
> there reasons for using old-style object?
No, use new style if you can - except from the rare cases where above
mentioned backwards
I'm confused by the concepts of old-style vs new-style classes, I've read
most of the documents I found about this but it doesn't "click". Probably
because I wasn't around before 2.2.
Anyway, the reason for new style classes are to make the whole type/object
thing work better together. There ar