Why new Python 2.5 feature "class C()" return old-style class ?

Paul Boddie paul at boddie.org.uk
Sun Apr 23 19:52:02 EDT 2006


Christophe wrote:
> Aahz a écrit :
> > I'm certainly not alone in believing that new-style classes are
> > better avoided for newbies.
>
> Well, old-style classes are perfect to confuse the newbie. After all,
> there's nothing like adding a "property" in a class and wondering why
> it does not work as expected.

Well, for years everyone joked about Java's "public static void main"
business - confusing boilerplate for newbies, they said - but apart
from various deep runtime-dependent arguments, I can't see how "class
something(object)" is any less forgivable, especially in a teaching
environment where you've just explained that "object" and "instance"
are mostly interchangeable terms for something made from a class.

And to make the "guard of shame" (the opposite of a guard of honour)
complete in this sorry tale, it should be pointed out that they don't
make you write "class Something extends Object" all over the place in
Java, or at least not when I last wrote any Java code. Something to
think about for Python 3000 in the context of reaching a wider
audience, I suppose.

> What would be a language without horrible pitfalls ? Newbies would have
> it easy and they have no right for an easy language !

;-) Or were you being serious? :-O

Paul




More information about the Python-list mailing list