[Python-Dev] PEP 550 v4

Barry Warsaw barry at python.org
Sat Aug 26 14:22:39 EDT 2017


On Aug 26, 2017, at 14:15, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
> 
> Elvis just added it:
> https://www.python.org/dev/peps/pep-0550/#replication-of-threading-local-interface

Thanks, that’s exactly what I was looking for.  Great summary of the issue.
> 
>> 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”.
> 
> Nathaniel has a use case where he needs to know if the value is in the
> topmost LC or not.
> 
> One way to address that need is to have the following signature for lookup():
> 
>   lookup(*, default=None, traverse=True)
> 
> IMO "lookup" is a slightly better name in this particular context.

Given that signature (which +1), I agree.  You could add keywords for debugging lookup fairly easily too.

Cheers,
-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170826/9270a481/attachment.sig>


More information about the Python-Dev mailing list