On Wed, Dec 5, 2012 at 3:09 PM, Sturla Molden <span dir="ltr"><<a href="mailto:sturla@molden.no" target="_blank">sturla@molden.no</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
But perhaps it is possible to do this with AST magic? I don't know. Nor do I know if __bind__ is the best way to do this. Perhaps not. But I do know that automatically detecting when to "flush a compund expression with (NumPy?) arrays" would be the holy grail for scientific computing with Python. A binary operator x+y would just return a symbolic representation of the expression, but when the full expression needs to be flushed we can e.g. ask OpenCL or LLVM to generate the code on the fly. It would turn numerical computing into something similar to dynamic HTML. And we know how good Python is at generating structured text on the fly.<br>


<span class=""><font color="#888888"><br>
Sturla<br>
</font></span><div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>Not all pixel fiddling can be solved using array calculus, so there will always be C involved at some point.</div><div><br></div>

<div>Still this could be a great advancement. Though I don't think bind-time is the right time to evaluate anything as it would drive optimizing programmers to "one-line" things. Using intermediate variable names to explain an algorithm is crucial for readability in my experience.</div>

<div><br></div><div>Creating intermediate objects only to be evaluated when programmer explicitly demands is the way to go. E.g. "evalf" in sympy <a href="http://scipy-lectures.github.com/advanced/sympy.html">http://scipy-lectures.github.com/advanced/sympy.html</a></div>

</div></div>