Created
March 9, 2017 18:32
-
-
Save mattboehm/98ae4871ae21821c21cb9f2aecbb9c39 to your computer and use it in GitHub Desktop.
This file contains 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
Python 2.7.10 (default, Oct 23 2015, 19:19:21) | |
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import string | |
>>> string.letters | |
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
>>> help(string) | |
>>> string.letters | |
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' |
@kms70847 I assume it has something to do with the fact that help
sometimes launches a pager (i.e. less
), but I haven't really looked into it yet.
Furthermore:
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import string
>>> id(string.letters)
140641450093232
>>> help(string)
>>> id(string.letters)
140641450093232
@dschep that's not so surprising, the new string.letters
just happens to get the same ID, same as this question. If you assign the original string.letters
to a variable the updated string.letters
will have a different ID.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On ipython, it is already reversed the first time, and calling help on string doesn't change it. Tested on python 2.7.6, ubuntu 14.04, locale en_US UTF-8, ipython 5.1.0