Immutable and Mutable Types

cokofreedom at gmail.com cokofreedom at gmail.com
Mon Mar 17 04:32:38 EDT 2008


> >>> a = 1
> >>> b = 1
> >>> a is b
> True
> >>> id(a)
> 10901000
> >>> id(b)
> 10901000

Isn't this because integers up to a certain range are held in a single
memory location, thus why they are the same?



More information about the Python-list mailing list