By value or by reference?
Jonathan Ellis
jbellis at gmail.com
Mon Oct 18 11:55:29 EDT 2004
More information about the Python-list mailing list
Mon Oct 18 11:55:29 EDT 2004
- Previous message (by thread): By value or by reference?
- Next message (by thread): By value or by reference?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Roger Irwin wrote: > Riccardo Rossi wrote: > > > Hi all! > > > > How does Python pass arguments to a function? By value or by reference? > > > > Thanks, > > Riccardo Rossi. > > > > > By reference to an object....See the python tutorial. Wrong. Here is the difference between pass by reference and pass by value to CS types: >>> def foo(a): a = 1 ... >>> i = 10 >>> foo(i) >>> print i With pass-by-reference, i would now be 1. However, since python is pass-by-value, it remains 10. -Jonathan
- Previous message (by thread): By value or by reference?
- Next message (by thread): By value or by reference?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list