[issue1734] no effect if metaclass modifies dict

2008-01-04 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: When designing a metaclass, you should override __new__, not __init__: class MetaNode(type): def __new__(cls, name, bases, cdict): cdict['z'] = name return type.__new__(cls, name, bases, cdict) class Node(object): __metaclass__ = MetaN

[issue1734] no effect if metaclass modifies dict

2008-01-03 Thread L. Peter Deutsch
New submission from L. Peter Deutsch: In the following, dir(Node) should include the name 'z', and Node.z should be 'Node'. However, dir(Node) does not include 'z', and Node.z is undefined (AttributeError). This is directly contrary to the Python documentation, which says "metaclasses can modify