is there a difference between one line and many lines

Peter Otten __peter__ at web.de
Thu Apr 21 08:35:25 EDT 2011


Steven D'Aprano wrote:

> but:
> 
>>>> a = 1001; b = 10001; a is b
> False

I would hope so ;)

> The point is that Python is free to re-use immutable objects, or not re-
> use them, as it sees fit.
 
Indeed, and I even found a Python implementation on my harddisk that does 
what you intended to show:

$ ipy
IronPython 1.1.1 (1.1.1) on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
>>> a = 1001; b = 1001; a is b
False





More information about the Python-list mailing list