passing by refference
David Abrahams
dave at boost-consulting.com
Fri May 16 05:18:26 EDT 2003
Doug Quale <quale1 at charter.net> writes:
> If Python is not call-by-value, what is an r-value in Python that
> differs from what is passed to a function?
I should probably stay out of this, but...
it doesn't make a whole lot of sense to talk about r-values and
l-values in Python, because those terms are normally defined in terms
of assignment:
"an r-value is something that can appear on the right hand side of
an assignment"
"an l-value is something that can appear on the left hand side of
an assignment"
In Python, the only things that can appear on the LHS of an assignment
are names (not values in any reasonable sense). These terms were
invented to describe languages where assignment causes copying, and
they have analytical power because they distinguish two different
ideas. You can try to view assignment in Python as "copying a
reference" so that the terms apply, but then of course they lose all
power as distinctions: everything is both an l-value and an r-value.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Python-list
mailing list