list storing variables

Chris Angelico rosuav at gmail.com
Mon Feb 23 14:17:48 EST 2015


On Tue, Feb 24, 2015 at 6:06 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> What I'm saying is that there's nothing special about Python's object
> model or variables. Guido could decide tomorrow to add a C-esque "&"
> operator to Python without breaking a single existing Python program.
> The Python compiler would simply generate code like above.

Actually, there's a fairly huge difference. All you've done is create
a thing which can set a global... you don't have any way to pass
pointers around, like you can in C. (And that's even without getting
into pointer *arithmetic*.) You have to construct a dedicated "thing"
in your source code for every pointer you want to be able to work
with. And if you try to make a single generic "Ampersand" class, what
you'll find is that you're working with namespaces, not addresses. So
Python's name-binding model really is fundamentally different from C's
stuff-in-memory model.

ChrisA



More information about the Python-list mailing list