Immutable and Mutable Types

cokofreedom at gmail.com cokofreedom at gmail.com
Mon Mar 17 09:32:38 CET 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