Author ncoghlan
Recipients Jelle Zijlstra, barry, levkivskyi, ncoghlan, njs, yselivanov
Date 2017-06-07.11:59:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496836748.32.0.208056041242.issue30359@psf.upfronthosting.co.za>
In-reply-to
Content
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__
{}
```
History
Date User Action Args
2017-06-07 11:59:08ncoghlansetrecipients: + ncoghlan, barry, njs, yselivanov, levkivskyi, Jelle Zijlstra
2017-06-07 11:59:08ncoghlansetmessageid: <1496836748.32.0.208056041242.issue30359@psf.upfronthosting.co.za>
2017-06-07 11:59:08ncoghlanlinkissue30359 messages
2017-06-07 11:59:08ncoghlancreate