[Python-ideas] Method chaining notation
spir
denis.spir at gmail.com
Sat Feb 22 22:05:17 CET 2014
On 02/22/2014 03:42 PM, Masklinn wrote:
> Executing the method always has the same effect on its subject. That it
> may not be used for the same purpose is a different issue and common:
> a[k] = v can be used to add a new (k, v) pair or to update a key to a
> new value (in fact Erlang's new map construct makes the difference and
> provides for an update-only version).
You are right! and this is a weakness of python in my view. But you could as
well have chosen plain assignment, couldn't you? works the same way:
n = 1 # symbol creation / definition
n = 2 # symbol change / redefinition
[Note, as a side-point, that if def / redef signs were different, there would be
no ambiguity around local vs global scope. The ambiguity lies in fact in that
the compiler cannot know if one wants to create a local symbol or change a
global one. As for locally creating a global symbol, this should just not exist
;-); symbols live in their creation scope.]
d
More information about the Python-ideas
mailing list