Finding the instance reference of an object

Aaron Brady castironpi at
Thu Nov 6 22:22:00 CET 2008

On Nov 6, 1:44 pm, Arnaud Delobelle <arno... at> wrote:
> I know this thread has grown quite personal for some of its
> participants.  I am posting in a spirit of peace and understanding :)

Hear, hear.

> You refer to docs about the *implementation* of Python in C.  This is
> irrelevant.
> Also, you talk about variables 'containing' something.  In Python,
> variables don't contain anything, they're simply names for objects.
> 'Pass by value' is not relevant to Python as variables do not contain
> anything.  'Pass by reference' is not relevant to Python as the language
> doesn't have the concept of object reference (in the sense of e.g. C++
> reference).
> I would say that an oject is passed, not a reference.
> To sum up: for 'pass by value' to make sense in Python you need to
> create an unnecessarily complex model of how Python works.  By letting
> go of 'pass by value' you can simplify your model of the language
> (keeping it correct of course) and it fits in your brain more easily.
> Of course your own model is valid but there is a better one which is
> easier to grasp for people without a background in C/C++ - like
> languages.

I agree, and I don't think we're giving Joe the proper credit for what
he knows and has worked on.  Furthermore, his understanding of the
implementation of languages is thorough, and you can't have languages
without implementations.  Though, you do not need to understand the
implementation to understand the language.

I haven't thought it through completely, but now that Joe mentions it,
it appears Python behaves the same as C++, if variables can't be
anything but pointers, parameters are all c-b-v, and you can't
dereference the l-h-s of an assignment ( '*a= SomeClass()' ).

When you're explaining Python to a beginner, you have to introduce a
new term either way.  You'll either have to explain pointers, which
there are chapters and chapters on in introductory textbooks; or,
you'll have to explain a new calling mechanism, and give it a name.

I think pointer-by-value would be accurate, but by-value wouldn't be.

> I would say that an oject is passed, not a reference.

I agree, and anything else would be overcomplicated.

More information about the Python-list mailing list