Showing content from http://mail.python.org/pipermail/python-dev/attachments/20180103/050e0147/attachment.html below:
<div dir="auto"><span style="font-family:sans-serif">Victor:</span><div dir="auto"><span style="font-family:sans-serif">> ContextVar would be simpler if the default would be mandatory as well :-)</span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><font face="sans-serif">If we modify ContextVar to use None as the default value, the 'default' parameter of ContextVar.get() becomes useless, ContextVar.get() and context[var] behaviour becomes obvious. Token.MISSING could also be removed.</font></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">Since it's not possible to delete a variable, would it be crazy to always initialize variables with a value, None by default?</font></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">Decimal context is given as an example of contextvars user. Decimal already has a default context. I don't know numpy.errstate: would it make sense to initialize it to None?</font></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">If someone really needs the crazy case of "uninitialized" variable, a custom "UNINITIALIZED = object()" can be used, no?</font></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">With these proposed changes, there is no more need to worry if a variable is set or not.</font></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">It's unclear to me if context.items() contains variables which weren't explicit set, and so are set to their default value. Same question for "var in context" test. If variables always have a value, I would expect that "var in context" is always true but I don't understand if it's technically possible to implement it or even if it makes sense :-)</font></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">Maybe my whole proposed change doesn't make sense?</font></div><div dir="auto"><font face="sans-serif"><br></font></div><div dir="auto"><font face="sans-serif">Victor</font></div></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4