Multiple assignments simplification
Fredrik Lundh
fredrik at pythonware.com
Thu Oct 13 03:43:41 EDT 2005
bearophileHUGS at lycos.com wrote:
> I don't know if C++ compilers can do such optimizations.
working on a Python to C/C++ translator without knowing what kind
of optimizations a C/C++ compiler can do for you sounds like a great
way to waste your time...
(I would be rather bit surprised if any contemporary C or C++ compiler
didn't generate optimal machine code for source code that contains swaps
like the one you posted. it won't look at just the swap statement, however;
the interesting thing is where the values came from, and what you're doing
with the values later on. minimizing the number of assignment statements in
the swap translation won't change a thing...)
</F>
More information about the Python-list
mailing list