Does setting an ImplicitScopeVar to None set the value to None, or just remove it? If it removes it, does that effectively unmask a previously masked value? If it really sets to None, then is there a way to explicitly unmask previously masked values? Perhaps the initial constructor should require an initial value (defaulting to None) and the docs should give examples both for using a sensible default value and for using a special "unset" marker. -jJ
Hi Jim, it seems like each time you reply you change the subject line and start a new thread. Very few others are doing this (e.g. Yury when releasing a new version). Would it be possible for you to preserve the threading like others? --Chris On Sun, Aug 27, 2017 at 9:08 AM Jim J. Jewett <jimjjewett@gmail.com> wrote:
Does setting an ImplicitScopeVar to None set the value to None, or just remove it?
If it removes it, does that effectively unmask a previously masked value?
If it really sets to None, then is there a way to explicitly unmask previously masked values?
Perhaps the initial constructor should require an initial value (defaulting to None) and the docs should give examples both for using a sensible default value and for using a special "unset" marker.
-jJ
_______________________________________________ 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/chris.jerdonek%40gmail.co...
On 08/27/2017 11:02 AM, Chris Jerdonek wrote:
Hi Jim, it seems like each time you reply you change the subject line and start a new thread. Very few others are doing this (e.g. Yury when releasing a new version). Would it be possible for you to preserve the threading like others?
I must admit I'm torn here: on the one hand, having all the discussion in a single thread keeps the conversation in one place; on the other hand, having separate threads for very specific questions makes it easier to focus on the parts one is interested in without being overwhelmed by the volume. So while I'm okay either way, I do appreciate Jim trying to have focused threads. -- ~Ethan~
I believe that the current status is: - assigning None isn't treated specially – it does mask any underlying values (which I think is what we want) - there is currently no way to "unmask" - but it's generally agreed that there should be a way to do that, at least in some cases, to handle the save/restore issue I raised. It's just that Yury & Elvis wanted to deal with restructuring the PEP first before doing more work on the api details. -n On Aug 27, 2017 9:08 AM, "Jim J. Jewett" <jimjjewett@gmail.com> wrote:
Does setting an ImplicitScopeVar to None set the value to None, or just remove it?
If it removes it, does that effectively unmask a previously masked value?
If it really sets to None, then is there a way to explicitly unmask previously masked values?
Perhaps the initial constructor should require an initial value (defaulting to None) and the docs should give examples both for using a sensible default value and for using a special "unset" marker.
-jJ
_______________________________________________ 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/ njs%40pobox.com
On Sun, Aug 27, 2017 at 4:01 PM, Nathaniel Smith <njs@pobox.com> wrote:
I believe that the current status is:
- assigning None isn't treated specially – it does mask any underlying values (which I think is what we want)
Correct.
- there is currently no way to "unmask"
- but it's generally agreed that there should be a way to do that, at least in some cases, to handle the save/restore issue I raised. It's just that Yury & Elvis wanted to deal with restructuring the PEP first before doing more work on the api details.
Yes. I think it's a good time to start a discussion about this, I can list a couple ideas here. For checking if a context variable has a value in the topmost LC, we can add two new keyword arguments to the "ContextVar.lookup()" method: ContextVar.lookup(*, default=None, topmost=False) If `topmost` is set to `True`, `lookup` will only check the topmost LC. For deleting a value from the topmost LC we can add a new "ContextVar.delete()" method. Yury
On Aug 28, 2017, at 11:50, Yury Selivanov <yselivanov.ml@gmail.com> wrote:
For checking if a context variable has a value in the topmost LC, we can add two new keyword arguments to the "ContextVar.lookup()" method:
ContextVar.lookup(*, default=None, topmost=False)
If `topmost` is set to `True`, `lookup` will only check the topmost LC.
For deleting a value from the topmost LC we can add a new "ContextVar.delete()" method.
+1 -Barry
On Mon, Aug 28, 2017 at 9:26 AM, Barry Warsaw <barry@python.org> wrote:
On Aug 28, 2017, at 11:50, Yury Selivanov <yselivanov.ml@gmail.com> wrote:
For checking if a context variable has a value in the topmost LC, we can add two new keyword arguments to the "ContextVar.lookup()" method:
ContextVar.lookup(*, default=None, topmost=False)
If `topmost` is set to `True`, `lookup` will only check the topmost LC.
For deleting a value from the topmost LC we can add a new "ContextVar.delete()" method.
+1
Yes, that's the only way. (Also forgive me for ever having proposed lookup() -- I think we should go back to get(), set(), delete(). Things will then be similar to getattr/setattr/delattr for class attributes. -- --Guido van Rossum (python.org/~guido)
participants (7)
-
Barry Warsaw -
Chris Jerdonek -
Ethan Furman -
Guido van Rossum -
Jim J. Jewett -
Nathaniel Smith -
Yury Selivanov