passing by refference

Doug Quale quale1 at charter.net
Thu May 29 18:15:01 EDT 2003


aahz at pythoncraft.com (Aahz) writes:

> In article <Y3nxa.188397$K35.4450807 at news2.tin.it>,
> Alex Martelli  <aleax at aleax.it> wrote:
> >Aahz wrote:
> >> In article <873cjfbrxd.fsf at charter.net>,
> >> Doug Quale  <quale1 at charter.net> wrote:
> >>>
> >>>Argument passing in Java and C are no different from Python.
> >> 
> >> At the technical level, that's correct, provided you define "argument"
> >> correctly.  But because assignment does different things in Python, too
> >> many Java/C programmers get confused with Python's semantics.
> >
> >C, sure.  But I don't see how a Java programmer could possibly be
> >confused by Python's semantics for assignment and argument passing:
> >they're exactly parallel to the ones Java uses for all types that
> >subclass Object -- Java special-cases a few "lower-level" types such 
> >as int, but it's even difficult to show where that makes any
> >difference (apart from having to wrap int &c in Java if you want
> >to hold them in a Vector, and the like).
> 
> Given that I don't know Java, I wasn't sure whether Java borrowed C's
> semantics for structs; probably should have worded my response a bit
> differently.  Sorry about that.

Java argument passing behaves just like Python's.  Java is
call-by-value according to James Gosling.




More information about the Python-list mailing list