"pass by reference?"

Tripp Scott tripps81 at yahoo.com
Sat Feb 23 03:34:01 EST 2002


Suppose I want to make a function that modifies its argument:

  a = -1
  make_abs(a)
  print a # = 1

What is the Pythonic way of doing this? Wrap it in a list?

  make_abs([a])

t





More information about the Python-list mailing list