[Python-ideas] binding vs rebinding

Ben Finney ben+python at benfinney.id.au
Thu Feb 5 22:31:58 CET 2009


spir <denis.spir at free.fr> writes:

> I wonder why there is no difference in syntax between binding and
> rebinding. Obviously, the semantics is not at all the same, for
> humans as well as for the interpreter:

> * Binding: create a name, bind a value to it.
> * Rebinding: change the value bound to the name.

That's not obvious. The semantics could just as well be described as:

  * Binding: bind this name to that value.
  * Rebinding: bind this name to that value.

If I claimed this semantic description as “obvious”, I'd be just as
wrong to do so. But this description functions very well to explain
the semantics of these operations for me and others.

> I see several advantages for this distinction and no drawback. The
> first advantage, which imo is worthful enough, is to let syntax
> match semantics; as the distinction *makes sense*.

Since I see no sense in the distinction, I see the drawback of
unnecessarily complicating the syntax.

-- 
 \      “I went to a garage sale. ‘How much for the garage?’ ‘It's not |
  `\                                        for sale.’” —Steven Wright |
_o__)                                                                  |
Ben Finney




More information about the Python-ideas mailing list