New inited instance of class?

Francis Avila francisgavila at yahoo.com
Sun Dec 7 12:56:06 EST 2003


Peter Otten <__peter__ at web.de> wrote in message ...
>Samuel Kleiner wrote:
>> So can I make all my classes derive from object without
>> doing so explicitly- IE, without having to change every
>> single top-level class definition?
>>
>
>You can do it on a per-file basis by putting
>
>__metaclass__ = type
>
>once before the class definitions.

That strikes me as a very *bad* idea, because it's no longer obvious that
the classes themselves are new-style, and the OP might develop a bad habit
of using this to avoid typing '(object)' all the time.  (Or he might show us
all for fools, if ':' becomes shorthand for '(object):'.)

Aside from that, metaclasses are a more advanced and less-commonly-used
feature of classes, and therefore probably more vulnerable to change.  I
know it should work, but am uneasy that it might manifest some unexpected
behavior (or bug).
--
Francis Avila





More information about the Python-list mailing list