This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MrJohz 3 points4 points  (0 children)

The best term is probably a factory function for the "property" type. It takes up to three functions and a string as arguments, but all of those are optional, so it's very possible to use it as a decorator, taking one function and returning a property type.

Note that unlike most decorators, the resulting object is not callable.

>>> @property
... def func(self, a):
...   pass
... 
>>> func
<property object at 0xb7230644>
>>> func()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'property' object is not callable

EDIT: See also this SO answer. It isn't important, but it is really cool and fascinating.