[Python-ideas] PEP 505: None-aware operators

Brice Parent contact at brice.xyz
Sun Jul 29 06:37:14 EDT 2018


Le 29/07/2018 à 08:02, Steven D'Aprano a écrit :
> On Sun, Jul 29, 2018 at 12:49:13PM +1200, Greg Ewing wrote:
>> Abe Dillon wrote:
>>> others countering that `person.name <http://person.name>` is not how
>>> periods are used in natural languages, so using other symbols in
>>> unintuitive ways is perfectly fine.
>> Dots have been used for attribute access in so many languages
>> for so long that it has become the normal and expected syntax
>> to use. ?. is much more recent. Maybe in another 30 years, if
>> it has stood the test of time, it could be argued for on the
>> basis of familiarity, but not now.
> You're talking like the syntax is used only by a handful of experimental
> languages with a total user-base measured in the dozens.
>
> ?. is used by some of the most commonly used languages in the world,
> such as C++, Objective C and PHP, as well as up-and-coming "cool"
> languages getting lots of industry buzz, like Swift and Dart.
>
> Its certainly more familiar now than Python's slicing syntax was when
> Python first started.
But it's certainly less familiar than using 'foo++' and '++foo', but 
we're still writing 'foo += 1'. So familiarity in other languages is not 
the only point (alos, I'm convinced that if we were making a poll with 
average and advanced users of these languages about what these syntax 
were doing, a big proportion wouldn't know).

I believe the evolution should be done if the benefice are big enough 
(which I doubt, but I don't use Python in all the ways possible), not 
because others do it (whatever their reasons were). Then, when we know 
there's definitely a need to solve a problem, the solution should be 
chosen (??, but anything else could enter the discussion).

Here, we're mixing arguments about (and I confess I've done it too):
- how usefull it would be to have a solution to this problem
- if it should be solved by Python's syntax or by libraries (if it may 
be done, and if it may not, how spread are the use cases that can't be 
done this way)
- if other languages support something like that, if some are, how well 
this was accepted and if it's getting used in new code
- the proposed syntax itself


More information about the Python-ideas mailing list