ANN: decorator-4.0.0 released

Michele Simionato michele.simionato at gmail.com
Fri Jul 24 12:18:10 CEST 2015


The decorator module is over ten years old, but still alive and
kicking. It is used by several frameworks and has been stable for a long
time. It is your best option if you want to preserve the signature of
decorated functions in a consistent way across Python
releases. Version 4.0 is fully compatible with the past, except for
one thing: support for Python 2.4 and 2.5 has been dropped and now
there is an unified code base for Python 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5.

You can download the new release from PyPI with the usual

$ pip install decorator 

The source code and the documentation are on GitHub: 

https://github.com/micheles/decorator/blob/4.0.0/documentation.rst (for Python 2.X) 

https://github.com/micheles/decorator/blob/4.0.0/documentation3.rst (for Python 3.X) 

What's new
---------------------

Since now there is a single manual for all Python versions, I took the
occasion for overhauling the documentation. Therefore, even if you are
an old time user, you may want to read the docs again, since several
examples have been improved. The packaging has been improved and I
am distributing the code in wheel format too. The integration with
setuptools has been improved and now you can use ``python setup.py
test`` to run the tests.  A new utility function ``decorate(func,
caller)`` has been added, doing the same job that in the past was done
by ``decorator(caller, func)``. The old functionality is still there
for compatibility sake, but it is deprecated and not documented
anymore.

Apart from that, there is a new experimental feature. The decorator
module now includes an implementation of generic (multiple dispatch)
functions. The API is designed to mimic the one of
``functools.singledispatch`` (introduced in Python 3.4) but the
implementation is much simpler; moreover all the decorators involved
preserve the signature of the decorated functions.

Enjoy!

        Michele Simionato


More information about the Python-announce-list mailing list