[Python-Dev] PEP 550 v4

Yury Selivanov yselivanov.ml at gmail.com
Sat Aug 26 14:15:41 EDT 2017

On Sat, Aug 26, 2017 at 12:30 PM, Barry Warsaw <barry at 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 <ethan at 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:

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


More information about the Python-Dev mailing list