By value or by reference?

Alex Martelli aleaxit at yahoo.com
Mon Oct 18 14:24:28 EDT 2004


Josiah Carlson <jcarlson at uci.edu> wrote:

> > I've given up expressing my opinion on the matter.  Everyone here
> > seems to have a different notion of what "pass-by-reference" and
> > "pass-by-value" mean.  It's funny--I've never run into trouble with
> > these terms before seeing these discussions on C.L.Py.
> 
> It is because Python does it differently from most other languages, and

Actually, where "real objects" are concerned (there's a slew of
exceptions for primitive builtin types such as int) Java has quite
similar semantics for both assignment and parameter passing.  Python's
simpler: no exceptions.  C#'s more complicated: besides the types that
are built-in exceptions you can also make user-defined types that are
also exceptions.  But exceptions apart, the 'fundamental' semantics of
assignments and assignment passing is similar in all three languages.


Alex



More information about the Python-list mailing list