On Sun, 10 Jul 2005 21:10:36 -0700, Michael Spencer <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>...
>>
>> class Foo(object):
>> class __metaclass__(type):
>> def __setattr__(cls, name, value):
>> if type(cls.__dict__.get(name)).__name__ == 'Descriptor':
>>
Bengt Richter wrote:
...
>
> class Foo(object):
> class __metaclass__(type):
> def __setattr__(cls, name, value):
> if type(cls.__dict__.get(name)).__name__ == 'Descriptor':
> raise AttributeError, 'setting Foo.%s to %r is not allowed'
> %(name, value)
>
On 10 Jul 2005 13:38:22 -0700, "George Sakkis" <[EMAIL PROTECTED]> wrote:
>I'm trying to write a decorator similar to property, with the
>difference that it applies to the defining class (and its subclasses)
>instead of its instances. This would provide, among others, a way to
>define the equivale
I'm trying to write a decorator similar to property, with the
difference that it applies to the defining class (and its subclasses)
instead of its instances. This would provide, among others, a way to
define the equivalent of class-level constants:
class Foo(object):
@classproperty
def The