[issue20009] Property should expose wrapped function.

Raymond Hettinger report at bugs.python.org
Sun Dec 22 09:35:42 CET 2013


Raymond Hettinger added the comment:

> When using the @property decorator the wrapped functions 
> are not exposed for source introspection. 
> (At least I can't see how they are.)

The underlying functions are already exposed as the "fget", "fset", and "fdel" attributes of property objects.

Here is an example of how to access the source:

class Dog:
    @property
    def age(self):
        return 42

if __name__ == '__main__':
    import inspect
    age_property = Dog.__dict__['age']
    lines, size = inspect.getsourcelines(age_property.fget)
    print(''.join(lines))

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20009>
_______________________________________


More information about the Python-bugs-list mailing list