[Python-Dev] Rewrite @contextlib.contextmanager in C

Chris Angelico rosuav at gmail.com
Wed Aug 10 17:10:26 EDT 2016


On Wed, Aug 10, 2016 at 4:43 AM, Giampaolo Rodola' <g.rodola at gmail.com> wrote:
> Chris' SimplerContextManager solution is faster because it avoids the
> factory function but that is necessary for supporting the decoration of
> methods.

Hooking a tangent onto this: I have no idea, based on the current
source code, which layers of complexity are necessary for which
reasons. Possibly as a side effect of this transformation, you might
consider adding some comments to the code? There are a few (citing
tracker issues such as #11647 and #27112), but they don't cover
everything.

ChrisA


More information about the Python-Dev mailing list