[Numpy-discussion] ANN: numexpr 2.4.3 released
mistersheik at gmail.com
Mon Apr 27 19:35:51 EDT 2015
Also, FYI: http://numba.pydata.org/numba-doc/0.6/doc/modules/transforms.html
It appears that numba does get the ast similar to pyautodiff and only get
the ast from source code as a fallback?
On Mon, Apr 27, 2015 at 7:23 PM, Neil Girdhar <mistersheik at gmail.com> wrote:
> I was told that numba did similar ast parsing, but maybe that's not true.
> Regarding the ast, I don't know about reliability, but take a look at
> get_ast in pyautodiff:
> It looks up the __file__ attribute and passes that through compile to get
> the ast. Of course that won't work when you don't have source code (a .pyc
> only module, or when else?)
> Since I'm looking into this kind of solution for the future of my code,
> I'm curious if you think that's too unreliable for some reason? From a
> usability standpoint, I do think that's better than feeding in strings,
> * are not syntax highlighted, and
> * require porting code from regular numpy expressions to numexpr strings
> (applying a decorator is so much easier).
> On Mon, Apr 27, 2015 at 7:14 PM, Nathaniel Smith <njs at pobox.com> wrote:
>> On Apr 27, 2015 1:44 PM, "Neil Girdhar" <mistersheik at gmail.com> wrote:
>> > I've always wondered why numexpr accepts strings rather than looking a
>> function's source code, using ast to parse it, and then transforming the
>> AST. I just looked at another project, pyautodiff, which does that. And I
>> think numba does that for llvm code generation. Wouldn't it be nicer to
>> just apply a decorator to a function than to write the function as a Python
>> Numba works from byte code, not the ast. There's no way to access the ast
>> reliably at runtime in python -- it gets thrown away during compilation.
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion