A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088450.html below:

[Python-Dev] pyc files, constant folding and borderline portability issues

[Python-Dev] pyc files, constant folding and borderline portability issues [Python-Dev] pyc files, constant folding and borderline portability issuesTerry Reedy tjreedy at udel.edu
Tue Apr 7 23:11:41 CEST 2009
Alexandru Moșoi wrote:
>> From: "Cesare Di Mauro" <cesare.dimauro at a-tono.com>
>> So if Python will generate
>>
>> LOAD_CONST      1
>> LOAD_CONST      2
>> BINARY_ADD
>>
>> the constant folding code will simply replace them with a single
>>
>> LOAD_CONST      3
>>
>> When working with such kind of optimizations, the temptation is to
>> apply them at any situation possible. For example, in other languages
>> this
>>
>> a = b * 2 * 3
>>
>> will be replaced by
>>
>> a = b * 6
>>
>> In Python I can't do that, because b can be an object which overloaded
>> the * operator, so it *must* be called two times, one for 2 and one for 3.
> 
> Not necessarily. For example C/C++ doesn't define the order of the
> operations inside an expression (and AFAIK neither Python)

Yes is does. Expression/Evaluation order "Python evaluates expressions 
from left to right."

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4