Re: mjc4y@brunelleschi.cs.virginia.edu: python object model

Kenneth Manheimer (klm@NIST.GOV)
Wed, 31 Aug 1994 14:33:57 -0400 (EDT)

I think Craig Lawson raises some good issues in his posting, but there
is one that i think is a bit of a red herring:

> 4. Readability vs. Metaclass Proliferation: Will the ability to monkey
> with class operation lead to less readable Python code? I mention
> readability again because it is one of Python's strengths, and there
> are plenty of languages that are less so. Imagine:
> dict1['key'] = 1
> dict2['key'] = 1
> where "dict1" and "dict2" are of different classes and metaclasses.
> They (hopefully) will do something similar, but may cause different
> side effects. Is this desirable? Is this behavior similar to one of
> C++'s good features, or one of it's bad features?

You already have this complexity, without metaclasses. Specifically,
dict1 and dict2 need not be of different metaclasses to behave
drastically differently - if they're of different classes, they could
have different __setitem__ methods, and so have drastically different
behaviors, including side effects. ?

On the other hand, while we currently can safely presume that attribute
assignments, 'obj1.x = 22.33', will have the obvious and expected
immediate effect, metaclasses would probably change that aspect of the
ballgame completely.

(BTW, if anyone has a ready answer, i'm still curious what the reasons
are for distinguishing metaclass inheritance from regular class
inheritance. Or are we doing away with that, and just introducing
meta-methods like __setslot__ slot assignment and __callmethod__
method invocation directly into the standard repertoire?)

Ken
ken.manheimer@nist.gov, 301 975-3539