[Python-ideas] Dart-like method cascading operator in Python

Chris Angelico rosuav at gmail.com
Thu Nov 21 17:28:01 CET 2013


On Fri, Nov 22, 2013 at 3:17 AM, Perešíni Peter <ppershing at gmail.com> wrote:
> However, I would still make cascading operator different from dot just to be
> more explicit (to avoid confusion of the programmers that do not know about
> this feature yet -- double dot will indicate that this is a new syntax)

Good point. I tend to prefer using less syntactic elements rather than
more; when there's no reason to distinguish, why distinguish? (Compare
C++ with its two different object-member operators, dot for objects
and arrow for pointer-to-object. There's no sensible meaning for
pointer-dot-token, so why not merge the two operators?)  I do see the
value here in distinguishing, though.

The colon makes parsing unambiguous, as a leading dot has no meaning.
I'd say -0 on new syntax (double dot), it might be valuable for
clarity but I don't know how necessary it is.

ChrisA


More information about the Python-ideas mailing list