Reference?

mackstann mack at incise.org
Sat Aug 23 05:11:48 EDT 2003


On Sat, Aug 23, 2003 at 01:57:33AM -0700, Kris Caselden wrote:
> I've searched all the Python docs I could find, but I haven't seen any
> mention of referencing function arguments, such as you would with the
> & in c/c++. Is this possible in Python?

Python is pass-by-reference by default.

>>> f = []
>>> def foo(n):
...   n.append("hi")
...
>>> foo(f)
>>> print f
['hi']

-- 
m a c k s t a n n  mack @ incise.org  http://incise.org
A bore is someone who persists in holding his own views after we have
enlightened him with ours.





More information about the Python-list mailing list