Op 2005-01-12, Jeff Shannon schreef <[EMAIL PROTECTED]>: > Torsten Mohr wrote: > >> I still wonder why a concept like "references" was not >> implemented in Python. I think it is (even if small) >> an overhead to wrap an object in a list or a dictionary. > > Because Python uses a fundamentally different concept for variable > names than C/C++/Java (and most other static languages). In those > languages, variables can be passed by value or by reference; neither > term really applies in Python. (Or, if you prefer, Python always > passes by value, but those values *are* references.)
I would think the reference was the id. As such python always passes by reference, as the id of the parameter is the id of the argument. > Python doesn't > have lvalues that contain rvalues; Python has names that are bound to > objects. Passing a parameter just binds a new name (in the called > function's namespace) to the same object. > > It's also rather less necessary to use references in Python than it is > in C et. al. You use nothing but references in Python, that is the reason why if you assign a mutable to a new name and modify the object through either name, you see the change through both names. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list