diff options
| author | Michele Simionato <michele.simionato@gmail.com> | 2015-07-21 06:59:03 +0200 |
|---|---|---|
| committer | Michele Simionato <michele.simionato@gmail.com> | 2015-07-21 06:59:03 +0200 |
| commit | 70a97d4a48814d5305976c6480ae7228513ac04c (patch) | |
| tree | ff4aaee146423cfcbee97c9f3f13333bf28bb519 /documentation.rst | |
| parent | 34fc2466268ab2ba37d020335d08e7550fe8eecd (diff) | |
| download | python-decorator-git-70a97d4a48814d5305976c6480ae7228513ac04c.tar.gz | |
Copied the __qualname__ attribute
Diffstat (limited to 'documentation.rst')
| -rw-r--r-- | documentation.rst | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/documentation.rst b/documentation.rst index 9686321..054c180 100644 --- a/documentation.rst +++ b/documentation.rst @@ -4,7 +4,7 @@ The ``decorator`` module :Author: Michele Simionato :E-mail: michele.simionato@gmail.com -:Version: 4.0.0 (2015-07-20) +:Version: 4.0.0 (2015-07-21) :Supports: Python 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5 :Download page: http://pypi.python.org/pypi/decorator/4.0.0 :Installation: ``pip install decorator`` @@ -360,6 +360,10 @@ You can check that the ``__annotations__`` dictionary is preserved: Here ``f.__wrapped__`` is the original undecorated function. Such an attribute is added to be consistent with the way `functools.update_wrapper` work. +Another attribute which is copied from the original function is +`__qualname`, the qualified name. This is a concept introduced +in Python 3. In Python 2 the decorator module will still add a +qualified name, but its value will always be `None`. ``decorator.decorator`` @@ -679,12 +683,11 @@ source code which is probably not what you want: <BLANKLINE> (see bug report 1764286_ for an explanation of what is happening). -Unfortunately the bug is still there, even in Python 2.7 and 3.1. -There is however a workaround. The decorator module adds an -attribute ``.__wrapped__`` to the decorated function, containing -a reference to the original function. The easy way to get -the source code is to call ``inspect.getsource`` on the -undecorated function: +Unfortunately the bug is still there, even in Python 2.7 and 3.4 (it +will be fixed for Python 3.5, thought). There is however a +workaround. The decorated function has an attribute ``.__wrapped__``, +pointing to the original function. The easy way to get the source code +is to call ``inspect.getsource`` on the undecorated function: .. code-block:: python |
