[Python-Dev] PEP 567 v3 (original) (raw)

Guido van Rossum guido at python.org
Wed Jan 17 00:33:16 EST 2018


On Tue, Jan 16, 2018 at 5:33 PM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:

On Tue, Jan 16, 2018 at 8:27 PM, Nathaniel Smith <njs at pobox.com> wrote: [..] > token = cvar.set(...) > token.reset()

I see the point, but I think that having the 'reset' method defined on the ContextVar class is easier to grasp. It also feels natural that a pair of set/reset methods is defined on the same class. This is highly subjective though, so let's see which option Guido likes more.

I think this came up in one of the previous reviews of the PEP. I like Yury's (redundant) version -- it makes it clear to the human reader of the code which variable is being reset. And it's not like it's going to be used that much -- it'll be likely hidden inside a context manager.

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



More information about the Python-Dev mailing list