Can global variable be passed into Python function?
On Sun, 23 Feb 2014 23:10:36 +0200, Marko Rauhamaa wrote:
> Terry Reedy <tjreedy at udel.edu>:
>> Special-casing ints to store the value in the reference has been
>> proposed and rejected. I do not remember how far anyone went in trying
>> to code the idea, but I doubt that anyone got as far as getting the
>> test suite to pass.
> FWIW, elisp essentially does that. Anyway, we are discussing this to
> make it clear that the language definition is abstract.
No. The language definition is concrete: it describes a concrete
interface. You are confusing the interface with the implementation: the
language definition is only abstract with regard to the implementation,
which is free to vary, so long as the interface remains the same.
Regardless of the implementation, Python code must behave in certain
ways, and the reference implementation CPython defines the semantics of
variable as name binding, not fixed locations. Can this by implemented
using fixed locations? Of course it can, and is: the proof is that
CPython's name binding variables are implemented in C, which uses fixed
> All compliant
> implementations are equally correct. It doesn't make any difference
> whatsoever for a Python programmer how this or that object type has been
> implemented under the hood.
Performance can matter :-)
But you are correct, as far as it goes. Where you are going wrong is by
confusing the semantics of Python code with the underlying implementation
of the Python virtual machine.