Addition of a .= operator
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat May 20 20:11:35 EDT 2023
On 21/05/23 5:54 am, Alex Jando wrote:
> hash.=hexdigest()
That would be a very strange and unprecedented syntax that
munges together an attribute lookup and a call.
Keep in mind that a method call in Python is actually two
separate things:
y = x.m()
is equivalent to
f = x.m
y = f()
But it would not be possible to break down your .= syntax
in that way.
Another oddity is that these are equivalent:
x += y
x += (y)
i.e. the RHS is evaluated as usual before doing the +=.
But these would not be equivalent:
hash .= hexdigest()
hash .= (hexdigest())
In fact the latter would probably have to be disallowed, as it's
not at all clear what it should mean.
--
Greg
More information about the Python-list
mailing list