[issue25903] SUGGESTION: Optimize code in PYO

2015-12-18 Thread R. David Murray
R. David Murray added the comment: pyo files weren't removed, they were just renamed, and -O differentiated from -OO. The provides the opportunity to introduce additional "optimized byte code" versions that do other optimizations, which several people are working on. There are also other asp

[issue25903] SUGGESTION: Optimize code in PYO

2015-12-18 Thread Emanuel Barry
Emanuel Barry added the comment: *.pyo files have been removed from the language as of 3.5; instead, the optimization is done directly to the *.pyc files. Are you suggesting re-introducing *.pyo files or changing this behaviour in the current model? Also, 'if type(obj) is int' is *not* the sam

[issue25903] SUGGESTION: Optimize code in PYO

2015-12-18 Thread Chris Angelico
Chris Angelico added the comment: The trouble with that example is that the semantics aren't the same. The isinstance check will also be true for subclasses of int (for instance, isinstance(True,int) is True), but the equality check will catch only exact matches. And that's even before conside

[issue25903] SUGGESTION: Optimize code in PYO

2015-12-18 Thread Devyn Johnson
New submission from Devyn Johnson: I have a suggestion. When Python code is byte-compiled to *.pyo files, what if byte-compiler were to be made to enhance some of the code. For instance, "if type(OBJECT) == int:" would be changed to "if isinstance(OBJECT, int):". Python is used in numerous sof