[Python-Dev] PEP 567 pre v3 (original) (raw)
Guido van Rossum guido at python.org
Tue Jan 9 16:22:46 EST 2018
- Previous message (by thread): [Python-Dev] PEP 567 pre v3
- Next message (by thread): [Python-Dev] PEP 567 pre v3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
There are too many words here for me to follow. I'll wait a few days and then hopefully there's a new proposal that you are all in agreement with, or there are two brief alternatives that I have to choose between.
On Tue, Jan 9, 2018 at 7:41 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
By default, threading.local raises an AttributeError (unless you subclass it.) Similar to that and to NameErrors, I think it's a good idea for ContextVars to raise a LookupError if a variable was not explicitly set.
Yury
On Tue, Jan 9, 2018 at 7:15 PM Victor Stinner <victor.stinner at gmail.com> wrote: 2018-01-09 12:41 GMT+01:00 Yury Selivanov <yselivanov.ml at gmail.com>: > But I'd be -1 on making all ContextVars have a None default > (effectively have a "ContextVar.get(default=None)" signature. This > would be a very loose semantics in my opinion.
Why do you think that it's a loose semantics? For me ContextVar/Context are similar to Python namespaces and thread local storage. To "declare" a variable in a Python namespace, you have to set it: "global x" doesn't create a variable, only "x = None". It's not possible to define a thread local variable without specifying a "default" value neither. Victor
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/20180109/60e63ea6/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 567 pre v3
- Next message (by thread): [Python-Dev] PEP 567 pre v3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]