Nick Coghlan added the comment:

Even Python 2 functions support setting arbitrary attributes, so 
contextlib2.contextmanager can always just add an __annotations__ dict to 
decorated functions if it doesn't already exist.

```
>>> def f():
...     pass
... 
>>> f.__annotations__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'function' object has no attribute '__annotations__'
>>> f.__annotations__ = {}
>>> f.__annotations__
{}
```

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30359>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to