On Sat, Aug 26, 2017 at 12:30 PM, Barry Warsaw <ba...@python.org> wrote:
> I agree with David; this PEP has really gotten to a great place and the new 
> organization makes it much easier to understand.
>
>> On Aug 25, 2017, at 22:19, Ethan Furman <et...@stoneleaf.us> wrote:
>>
>> Why "lookup" and not "get" ?  Many APIs use "get" and it's functionality is 
>> well understood.
>
> I have the same question as Sven as to why we can’t have attribute access 
> semantics.  I probably asked that before, and you probably answered, so maybe 
> if there’s a specific reason why this can’t be supported, the PEP should 
> include a “rejected ideas” section explaining the choice.

Elvis just added it:
https://www.python.org/dev/peps/pep-0550/#replication-of-threading-local-interface

>
> 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.

Yury
_______________________________________________
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/archive%40mail-archive.com

Reply via email to