On 4 January 2018 at 00:17, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>>
>> contextvars.copy_context().run(func, <args>)
>
>
> If contexts are immutable, why is there something
> called copy_context?

Agreed. This was something that bothered me, too. I mentioned it in my
review, but that seemed to get lost in the other comments in this
thread...

I get the impression that the logic is that the context is immutable,
but the ContextVars that it contains aren't, and the copy is deep (at
least 1 level deep) so you copy then change the value of a ContextVar.
But rereading that sentence, it sounds confused even to me, so it's
either not right or the implementation falls foul of "If the
implementation is hard to explain, it's a bad idea." :-)

Paul
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to