Created
September 15, 2013 08:09
-
-
Save narfdotpl/6568808 to your computer and use it in GitHub Desktop.
integer allocation in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python2.7 | |
Python 2.7.2 (default, Oct 17 2011, 00:04:42) | |
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> result = None | |
>>> for n in range(1000): | |
... m = int(str(n)) | |
... previous_result = result | |
... result = n is m | |
... if result != previous_result: | |
... print n, result | |
... | |
0 True | |
257 False | |
>>> | |
$ python3.3 | |
Python 3.3.1 (default, Sep 15 2013, 10:03:49) | |
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> result = None | |
>>> for n in range(1000): | |
... m = int(str(n)) | |
... previous_result = result | |
... result = n is m | |
... if result != previous_result: | |
... print(n, result) | |
... | |
0 True | |
257 False | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/cc @PawelStiasny