[issue36592] is behave different for integers in 3.6 and 3.7
New submission from Geraldo Xexeo : # When you run the program: a,b=300,300 print(a is b) #you get different results in 3.6 (True) and 3.7 (False) -- components: Interpreter Core files: testisbehavior.py messages: 339900 nosy: Geraldo.Xexeo priority: normal severity: normal status: open title: is behave different for integers in 3.6 and 3.7 versions: Python 3.6, Python 3.7 Added file: https://bugs.python.org/file48259/testisbehavior.py ___ Python tracker <https://bugs.python.org/issue36592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36592] is behave different for integers in 3.6 and 3.7
Geraldo Xexeo added the comment: "So 2**8 is a magic number, for whatever reason." Actually, this is true. Accordingly to https://rushter.com/blog/python-integer-implementation/ "Optimization of commonly-used integers Small integer objects in a range of -5 to 256 are always pre-allocated during initialization. Because Python integers are immutable, we can use them as singletons. Every time you need to create small integer instead of creating new object Python just points to already allocated one. Thereby it saves a lot of space and computation for commonly-used integers. Interestingly enough, the PyLongObject structure takes at least 28 bytes for every allocated integer and therefore takes three times as much memory as a simple 64-bit C integer." This are constants #define NSMALLPOSINTS 257 #define NSMALLNEGINTS 5 You can find the code in: https://github.com/python/cpython/blob/master/Objects/longobject.c -- ___ Python tracker <https://bugs.python.org/issue36592> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15809] IDLE console uses incorrect encoding.
Geraldo Xexeo added the comment: The same program will behave different in Windows and Mac. utf-8 works on Mac (10.6.8), cp1256 does not print some lines cp1256 works on Windows 7, utf-8 prints some characters in a wrong way For the record, I use accentuated letters from Portuguese alphabet ( ã ã, for example). -- nosy: +Geraldo.Xexeo ___ Python tracker <http://bugs.python.org/issue15809> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9290] IDLE and Command line present different behavior for sys.stdin
New submission from Geraldo Xexeo : The fact that in IDLE sys.stdin is a idlelib.rpc.RPCProxy results in programs having different behavior in IDLE and in Command Line mode. I noticed that when grading many students exercises in IDLE. Things like: sys.stdin.readlines() just don´t exists in IDLE, but are fully operational in Command Line mode. In Command Line mode, sys.stdin is a file. This is expected, as the manual (27.1) says that sys.stdin (and stdout and stderrr) are "File objects corresponding to the interpreter’s standard input" There are also other "quirks". I fell that is really strange that stdin has different behavior for the same program. -- components: IDLE, IO messages: 110621 nosy: Geraldo.Xexeo priority: normal severity: normal status: open title: IDLE and Command line present different behavior for sys.stdin versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue9290> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com