Proposal for new minor syntax

Mario Figueiredo marfig at gmail.com
Fri Mar 27 20:33:58 EDT 2015


On Sat, 28 Mar 2015 10:39:04 +1100, Ben Finney
<ben+python at benfinney.id.au> wrote:

>Jamie Willis <jw14896.2014 at my.bristol.ac.uk> writes:
>
>> This could be written as:
>>
>> hello = "hello world              "
>> hello .= strip()
>
>?1, “.=” is visually too similar to “=”.

can't be much worse than

    hello = "hello world    ",

I think the dot next to the equal sign makes it very distinctive. The
equal sign is something we are so visually used to that any small
deviation gets immediately recognized by our brain. I may be wrong on
this assumption...

>
>Syntax that is ambiguous at a glance is a cost when reading, and here I
>think the cost is great.

I think the bigger issue here is consistency. And I like my
programming languages to sport consistent syntax and semantics. Or at
least to remain onsistent unless there is a good reason not to.

In Python the dot sign isn't an operator. It is a delimiter. So it
feels odd for me to see it treated as an operator. More precisely, in
Python, delimiters that form an augmented assignment operator consist
of an operator followed by the equal sign delimiter. This proposal
would be the only exception.

I'm personally not very found of that.



More information about the Python-list mailing list