Hello,

I've been experimenting with metaclasses a bit (even though I am quite
a newbie to python) and stumpled over the following problem in my code:

class Meta(type):
  def __init__(cls, name, bases, dct):
    for attr, value in dct.items():
      if callable(value):
        dct[attr] = wrapper(value)

wrapper adds debugging-information to methods of the class (at least
that is my plan).

Using dct[attr] = wrapper(value) does not result in wrapped methods,
though. Using setattr(cls, attr, wrapper(value)) creates the desired
effect, though.

Why are the changes to dct not visible in the instantiated class? Is
dct not the namespace of the class currently instantiated?


best regards
Steffen

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to