David Mertz wrote:

> `spam?.eggs?.cheese?.aardvark` is NOT redundant for
> `spam?.eggs.cheese.aardvark`.  The two expressions simply do different
> things [...]

I agree, assuming ?. is a binary operator.  Given this, in Python (+
PEP 505) one can write

    tmp = spam ?. eggs
    val1 = tmp ?. cheese ?. aardvark    # For spam?.eggs?.cheese?.aardvark
    val2 = tmp . cheese . aardvark    # For spam?.eggs.cheese.aardvark

No special knowledge of PEP 505 is needed. If val1 is always equal to
val2, then the dot and None-dot operators must be the same. From the
assumptions, this is something that can be mathematically proved.

By the way, there's a widely used programming language in which
    val = a.method()
and
    tmp = a.method
    val = tmp()
are not always equivalent. Can you guess which language it is?

The answer is in:
https://www.slideshare.net/jonathanfine/javascript-the-easiest-quiz-in-the-world-ever
(question 6: Dot binds).

I'll now go back to following the example of Steve Bower and Raymond
Hettinger, which in my words is to wait until we have proper cover for
the BDFL's vacation.

-- 
Jonathan
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to