Wildemar Wildenburger schrieb: > Diez B. Roggisch wrote: >> It is that very apply. >> >> And apply takes a function as argument + additional arguments, and >> executes >> that function, returning the result of that function-call. It was used >> before the >> f(*args, **kwargs) >> >> notation was introduced. >> >> Now what we have here is "value" as function, passed as single >> argument to >> apply (because decorators are just callables), which will invoke "value" >> with no arguments. The result of that operation is the property-object, >> that thus is returned by apply. And in the end gets assigned to the name >> value in the cpu_ports-class. >> > Sooo clever :). But apply is deprecated ... can I do the same thing some > other way?
Deprecated doesn't mean it's not available. And even if it goes away, you can simply write it yourself: def apply(f, *args, **kwargs): return f(*args, **kwargs) So, if you want to, you can introduce your own function, e.g. def makeprop(f): return f and then do class Foo(object): @makeprop def bar(): ... # the fancy stuff Diez -- http://mail.python.org/mailman/listinfo/python-list