Per instance descriptors ?
Steven Bethard
steven.bethard at gmail.com
Thu Mar 23 11:24:38 EST 2006
bruno at modulix wrote:
> Steven Bethard wrote:
>> Could you explain again why you don't want baaz to be a class-level
>> attribute?
>
> Because the class is a decorator for many controller functions, and each
> controller function will need it's own set of descriptors, so I don't
> want to mess with the class.
So you're trying to add property-like attributes to functions? That is,
you want something like:
@my_decorator
def f(...):
...
f.foo # calls f._get_foo()
in another post, bruno at modulix wrote:
> This would imply a decorator subclass and a descriptor subclass for
> each and every controller function - which is what I'm trying to
> avoid.
So you only want one decorator? Doesn't that mean that all functions
will have the same attributes? But if that were true you would only
need one descriptor for all controller functions, so I must not be
understanding that right.
Can you give a little more realistic code sample? I'm still not sure
what it is you really want to do. Don't worry about showing the
implementation you're thinking of. Just show me how you want to use
these things and what it ought to look like.
STeVe
More information about the Python-list
mailing list