binding a reference to a variable
Andrew Koenig
ark at research.att.com
Wed Apr 10 11:52:23 EDT 2002
Greg> Andrew Koenig (ark at research.att.com) wrote:
Greg> : My motivation is to be able to write something that is analogous
Greg> : to call-by-reference in C++.
Greg> *Not* having call-by-reference means that you can read code without
Greg> wondering whether a particular function call is or is not by reference. I
Greg> consider this a blessing, and I'd like to think that the developers of
Greg> Lisp, C, Java, and Python feel the same way.
Of course, C arrays behave as if they are pass-by-reference
(only!), even though we both know that's not strictly true
under the skin.
Anyway, I would be quite content even if the references were
explicit at the point of call, which would meet your objection.
And there is even a straightforward way to achieve that state
now: Pass a pair of get/set functions instead of the variable
itself.
So in fact there is a way to do what I want; it's just that it's
more verbose than I'd like.
--
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list
mailing list