New inited instance of class?
francisgavila at yahoo.com
Sun Dec 7 18:59:51 CET 2003
Aahz wrote in message ...
>In article <vt5b8npantkt35 at corp.supernews.com>,
>Francis Avila <francisgavila at yahoo.com> wrote:
>>If you're curious, look in the Python Language Reference at the old
>>and new style classes to see the differences. There's absolutely no
>>advantage to old style classes, so stop usin' 'em.
><raised eyebrow> In addition to the factors Fredrik mentioned,
I responded to those concerns separately.
>also the issue that new-style classes are more of a moving target WRT
>syntax and semantics; for complex uses, it can be tricky (or impossible)
>to get the same code working the same way on both 2.2 and 2.3.
True, but if you are coding for both 2.2 and 2.3, you have to avoid a great
deal more than new-style classes (but, what changed besides the mro?). If
we're worried about compatability with pre-2.2, shouldn't we not be using
__class__ either? Barring trying to get code running on 2.2, it seems we
should be coding for new-style classes where possible, and it's possible
almost everywhere. Classic classes are on their way out, and eight more
keystrokes now means fewer headaches later.
>More than that, you *can't* use new-style classes for exceptions.
Exceptions should be derived from Exception or a subclass thereof, so
whether they're new- or old-style is not an issue. When Python supports
new-style class exceptions, Exception will be changed to reflect that.
>please stop telling people to avoid classic classes.
Someone better tell Alex Martelli, too, because IIRC he is far more gung-ho
on using new-style classes absolutely everywhere than I am. I believe he
said the only time he uses them is when he forgets to type (object), which
is about where I'm at.
More information about the Python-list