call by reference howto????

Antoon Pardon apardon at forel.vub.ac.be
Fri Mar 14 06:38:52 EDT 2008


On 2008-03-13, Terry Reedy <tjreedy at udel.edu> wrote:
>
> "Antoon Pardon" <apardon at forel.vub.ac.be> wrote in message 
> news:slrnfthp1s.61k.apardon at rcpc42.vub.ac.be...
>| On 2008-02-28, Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> 
> wrote:
>| > On Thu, 28 Feb 2008 02:02:19 +0200, Tamer Higazi wrote:
>| >
>| >> Hi!
>| >> Can somebody of you make me a sample how to define a function based on
>| >> "call by reference" ???
>| >
>| > Python doesn't do call by reference. Nor does it do call by value. 
> Please
>| > pay no attention to anyone who says it does.
>|
>| Whatever python has for a calling convention, it is close enough that
>| naming it "call by reference" gives people a reasonable idea of what
>| is going on.
>
> But it is also different enough to mislead people.

IMO the confusing come more from people expecting the assignment to
be some kind of mutating operation. 

>| AFAICS people don't have a problem with understanding the calling
>| convention of python. They have a problem understanding the
>| assignment semantics.
>
> The calling convention is cross-namespace assignment.  So one cannot 
> understand calls without understanding assignment.

In that case I find it very strange that when this question comes
up, I see so few attempts to explain how the assignment acctually
works.

-- 
Antoon Pardon



More information about the Python-list mailing list