Richard Damon <rich...@damon-family.org>:

>> On Jul 22, 2018, at 3:50 PM, Marko Rauhamaa <ma...@pacujo.net> wrote:
>> I wish people stopped talking about "name binding" and "rebinding,"
>> which are simply posh synonyms for variable assignment. Properly, the
>> term "binding" comes from lambda calculus, whose semantics is defined
>> using "bound" and "free" variables. Lambda calculus doesn't have
>> assignment.
>
> Marko, I think the term binding makes sense in python due to how names
> work. In python and the following code:
>
> X = getit()
> Y = X
> X.changeit()
>
> In python, presuming getit() returns some form of object (so it has a
> changeit() member) then X and Y are bound to the same object, and
> changeit() will thus also affect the object that we see at Y.

Would you call it binding in this case:

   X[0]["z"] = getit()
   X[3]["q"] = X[0]["z"]
   X[0]["z"].changeit()

I think what you are talking about is more usually called "referencing."

> With a language with more ‘classical’ variable, the assignment of Y =
> X would normal make a copy of that object, so the value Y does not get
> changed by X.changeit().

I Java terms, all Python values are boxed. That's a very usual pattern
in virtually all programming languages (apart from FORTRAN).


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

Reply via email to