Reply to comment

passing

Passing is always by reference. Python has a concept of mutable vs immutable datatypes. List is mutable, tuple is not. int, float, bool, string are immutable too. You can not modify a immutable object.

a = 5 # a is pointing to immutable object int(5)
a = a + 1 # a is not pointing to a immutable object object int(6)

Callee passes 5 by reference, function gets the location of object int(5), but the function pointed the local variable a to a new location, int(6), and callee was not notified. Hope it clears up things.

Submitted by Amit Upadhyay (not verified) on Fri, 10/03/2006 - 23:27.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
4 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Google ads

(You can disable these if you log in)