[EMAIL PROTECTED] wrote:
> Oops! This isn't working. As the sequence I'm trying for is....
>>>> def set_classvars(**kwargs):
> ...     def __metaclass__(name, bases, classdict):
> ...         for name, value in kwargs.iteritems():
> ...              if name not in classdict:
> ...                  classdict[name] = value
> ...         return type(name, bases, classdict)
> ...     return __metaclass__
> ...
>>>> class C(object):
> ...     __metaclass__ = set_classvars(name='foo', desc='bar', list=[])
> ...     name = 'not foo'
> ...
>>>> C.name, C.desc, C.list
> ('not foo', 'bar', [])
>>>> class D(C):
> ...      pass  #<<<<<< Use Super's metaclass
> ...
>>>> D.name, D.desc, D.list, D.list is C.list
> ('not foo', 'bar', [], True)

What should the "right" answer be here?  Maybe

('foo', 'bar', [], False)

or

('not foo', 'bar', [], False)

or something else?


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

Reply via email to