On 28/03/2015 09:53, Steven D'Aprano wrote:
On Sat, 28 Mar 2015 10:08 am, BartC wrote:

An alternate syntax might be:

   hello = .string()

That should have been .strip()


   loop_node =. next

Why propose that?

Every other augmented assignment has the operator on the left hand side of
the equals. Greater-than, less-than, and not-equal all have the symbol on
the left hand side of the equals:

+= -= *= **= /= //= %= |= ^= &= <= >= != =.

> ... and I'm dubious about pretending that . is an operator

I see where you're coming from now. You're thinking that it is "." that is the operator, but I'm looking at "strip()" as the operator that is being applied.

I see the "." as just a bit of necessary syntax that introduces this style of operator as a /unary/ operation, not a binary operation like all those examples.

Maybe that's just the way Python does it. However, take this example using negation:

 a = -a

which is clearly applying a unary operator, and imagine there existed a method (if that's the word) called "neg", that also returned the negative value of its operand:

 a = a.neg()

This does exactly the same thing. But suddenly you're now applying a binary operator "." instead of a unary one!

(I'm not sure how this all applies to the loop_node.next example, but even here I don't count the "." as an operator, but syntax. In the languages I'm used to, the right-hand-side cannot be a conventional operand.)

--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to