Python sys.maxint, sys.maxunicode on Linux and windows

前端 未结 2 1503
半阙折子戏
半阙折子戏 2020-12-18 07:56

On 64-bit Debian Linux 6:

Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
[GCC 4.4.5] on linux2
Type \"help\", \"copyright\", \"credits\" or \"license\" for         


        
相关标签:
2条回答
  • 2020-12-18 08:49

    I don't know what your question is, but sys.maxunicode is not wrong on Windows.

    See the docs:

    sys.maxunicode

    An integer giving the largest supported code point for a Unicode character. The value of this depends on the configuration option that specifies whether Unicode characters are stored as UCS-2 or UCS-4.

    Python on Windows uses UCS-2, so the largest code point is 65,535 (and the supplementary-plane characters are encoded by 2*16 bit "surrogate pairs").

    About sys.maxint, this shows at which point Python 2 switches from "simple integers" (123) to "long integers" (12345678987654321L). Obviously Python for Windows uses 32 bits, and Python for Linux uses 64 bits. Since Python 3, this has become irrelevant because the simple and long integer types have been merged into one. Therefore, sys.maxint is gone from Python 3.

    0 讨论(0)
  • 2020-12-18 08:57

    Regarding the difference is sys.maxint, see What is the bit size of long on 64-bit Windows?. Python uses the long type internally to store a small integer on Python 2.x.

    0 讨论(0)
提交回复
热议问题