Message295333
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__
{}
``` |
|
Date |
User |
Action |
Args |
2017-06-07 11:59:08 | ncoghlan | set | recipients:
+ ncoghlan, barry, njs, yselivanov, levkivskyi, JelleZijlstra |
2017-06-07 11:59:08 | ncoghlan | set | messageid: <1496836748.32.0.208056041242.issue30359@psf.upfronthosting.co.za> |
2017-06-07 11:59:08 | ncoghlan | link | issue30359 messages |
2017-06-07 11:59:08 | ncoghlan | create | |
|