Message315212
In contextlib, there is code which roughly looks like
def _exit_wrapper(exc_type, exc, tb):
return cm_exit(cm, exc_type, exc, tb)
_exit_wrapper.__self__ = cm
This creates a new function _exit_wrapper from a given function cm_exit by prepending the __self__ attribute to *args. Now this is exactly what a method does too.
It would be better to use an actual method for this: it's cleaner, faster and it doesn't abuse a double-underscore attribute. The latter will actually break with PEP 575, as __self__ will become a special name instead of an arbitrary attribute. |
|
Date |
User |
Action |
Args |
2018-04-12 05:24:51 | jdemeyer | set | recipients:
+ jdemeyer |
2018-04-12 05:24:51 | jdemeyer | set | messageid: <1523510691.14.0.682650639539.issue33265@psf.upfronthosting.co.za> |
2018-04-12 05:24:50 | jdemeyer | link | issue33265 messages |
2018-04-12 05:24:49 | jdemeyer | create | |
|