Pass by reference ?

Nick Maclaren nmm1 at
Wed Apr 5 18:02:40 CEST 2000

In article <38EAB103.E76E74C2 at>, Greg Ewing <greg at> writes:
|> Nick Maclaren wrote:
|> > 
|> > Unless I am thoroughly confused, Python uses bog-standard call by
|> > reference, with the wrinkle that assignment is a rebinding rather
|> > than a copying operation.  AM I confused about that?
|> The trouble with describing Python parameter passing as
|> "call by reference" is that that term implies something
|> like a Pascal VAR parameter, which Python most certainly
|> does *not* have. That's why Mr. Generowicz got confused -
|> he thought it meant that a reference to the *variable*
|> x was being passed.

Maybe, though Pascal VAR parameters are usually regarded as an
aberrant form of call by reference.

|> If I had to pick one of the standard terms, I would describe 
|> Python parameter passing as call-by-value, with the wrinkle 
|> that the value being passed is always a reference to an object.

Well, you could put it that way :-)  That particular viewpoint
is very similar to that of the the base Algol 68 language (i.e.
WITHOUT the syntactic sugar of variable declarations), which had
similar properties except that identifiers (i.e. names) were not

It comes down to whether you think that the argument is the
object, or the reference to the object.

Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

More information about the Python-list mailing list