By value or by reference?

Dan Bishop danb_83 at yahoo.com
Tue Oct 19 02:18:07 CEST 2004


"Riccardo Rossi" <riccardo.rorssi76 at email.it> wrote in message news:<OkRcd.157598$35.7725273 at news4.tin.it>...
> Hi all!
> 
> How does Python pass arguments to a function? By value or by reference?

If you're familiar with C, think of it this way

/* Python function

   def foo(arg1, arg2):
      localA = arg1
      localB = bar(arg2)
      # ...
          
*/
object *foo(object *arg1, object *arg2) {
   object *localA = arg1;
   object *localB = bar(arg2);
   /* ... */  
}



More information about the Python-list mailing list