This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jdemeyer
Recipients jdemeyer
Date 2018-04-12.05:24:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1523510691.14.0.682650639539.issue33265@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-04-12 05:24:51jdemeyersetrecipients: + jdemeyer
2018-04-12 05:24:51jdemeyersetmessageid: <1523510691.14.0.682650639539.issue33265@psf.upfronthosting.co.za>
2018-04-12 05:24:50jdemeyerlinkissue33265 messages
2018-04-12 05:24:49jdemeyercreate