Pass variable by reference

Marko Rauhamaa marko at pacujo.net
Wed May 7 17:22:55 EDT 2014


Mark H Harris <harrismh777 at gmail.com>:

> A == B
> True
>
> A is B
> False
>
> [...]
>
> This is just one of a dozen 'different' kinds of examples. And the
> answer is the same, Python does not have variables, Python has names
> bound to objects.

That is a different topic and isn't related to variables at all.
Instead, you are talking about object identity:

  >>> 2 * 3000 == 6000
  True
  >>> 2 * 3000 is 6000
  False
  >>> "abc"[:1] == "a"
  True
  >>> "abc"[:1] is "a"
  False

But hey, we can open another thread for whether Python has values or
objects!


Marko



More information about the Python-list mailing list