Variable Assignment

Variable assignment is a naming operation

     a = 42 
  • This creates an integer object with value 42.
  • "a" is a name that refers to the object.

Reference Counting

  • All objects are reference counted.
  • Variable assignment is nothing more than a reference copy (increases the reference count).
  • Example:
     b = a
  • Now "a" and "b" are both names for the exact same object.
<<< O'Reilly OSCON 2000, Introduction to Python, Slide 45
July 17, 2000, beazley@cs.uchicago.edu
>>>