[Python-ideas] New __reference__ hook
Yuval Greenfield
ubershmekel at gmail.com
Wed Dec 5 21:50:41 CET 2012
On Wed, Dec 5, 2012 at 3:09 PM, Sturla Molden <sturla at molden.no> wrote:
>
> 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.
>
> Sturla
>
>
Not all pixel fiddling can be solved using array calculus, so there will
always be C involved at some point.
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.
Creating intermediate objects only to be evaluated when programmer
explicitly demands is the way to go. E.g. "evalf" in sympy
http://scipy-lectures.github.com/advanced/sympy.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121205/2bde017e/attachment.html>
More information about the Python-ideas
mailing list