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

Guido van Rossum guido at python.org
Mon Aug 8 16:18:37 EDT 2016


I think Nick would be interested in understanding why this is the case.
What does the decorator do that could be so expensive?

On Mon, Aug 8, 2016 at 1:07 PM, Yury Selivanov <yselivanov.ml at gmail.com>
wrote:

>
>
> On 2016-08-08 3:33 PM, Giampaolo Rodola' wrote:
>
>> I wanted to give it a try rewriting this in C but since @contextmanager
>> has a lot of magic I wanted to ask first whether this 1) is technically
>> possible 2) is desirable.
>>
>
> It is definitely technologically possible.  However, the C implementation
> will be quite complex, and will require a lot of time to review and later
> maintain.  My question would be how critical is the performance of
> @contextmanager?  I'd say that unless it's used in a tight loop it can't
> affect the performance too much.
>
> Yury
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%
> 40python.org
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160808/745383af/attachment.html>


More information about the Python-Dev mailing list