<div dir="ltr">I'm convinced by the new section explaining why a single value is better than a namespace. Nonetheless, it would feel more "Pythonic" to me to create a property `ContextVariable.val` whose getter and setter was `.lookup()` and `.set()` (or maybe `._lookup()` and `._set()`).<div><br></div><div>Lookup might require a more complex call signature in rare cases, but the large majority of the time it would simply be `var.val`, and that should be the preferred API IMO. That provides a nice parallel between `<a href="http://var.name">var.name</a>` and `var.val` also.<br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 26, 2017 at 11:22 AM, Barry Warsaw <span dir="ltr"><<a href="mailto:barry@python.org" target="_blank">barry@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Aug 26, 2017, at 14:15, Yury Selivanov <<a href="mailto:yselivanov.ml@gmail.com">yselivanov.ml@gmail.com</a>> wrote:<br>
><br>
> Elvis just added it:<br>
> <a href="https://www.python.org/dev/peps/pep-0550/#replication-of-threading-local-interface" rel="noreferrer" target="_blank">https://www.python.org/dev/<wbr>peps/pep-0550/#replication-of-<wbr>threading-local-interface</a><br>
<br>
</span>Thanks, that’s exactly what I was looking for. Great summary of the issue.<br>
<span class="gmail-">><br>
>> That said, if we have to use method lookup, then I agree that `.get()` is a better choice than `.lookup()`. But in that case, would it be possible to add an optional `default=None` argument so that you can specify a marker object for a missing value? I worry that None might be a valid value in some cases, but that currently can’t be distinguished from “missing”.<br>
><br>
> Nathaniel has a use case where he needs to know if the value is in the<br>
> topmost LC or not.<br>
><br>
> One way to address that need is to have the following signature for lookup():<br>
><br>
> lookup(*, default=None, traverse=True)<br>
><br>
> IMO "lookup" is a slightly better name in this particular context.<br>
<br>
</span>Given that signature (which +1), I agree. You could add keywords for debugging lookup fairly easily too.<br>
<br>
Cheers,<br>
-Barry<br>
<br>
<br>______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/mertz%40gnosis.cx" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>mertz%40gnosis.cx</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons. Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div>
</div></div></div>