serge-sans-paille / pythran

Ahead of Time compiler for numeric kernels
https://pythran.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.98k stars 191 forks source link

supported numpy kwarg? #2172

Closed ogauthe closed 4 months ago

ogauthe commented 5 months ago

Hi,

I want to call a stable argsort on a numpy array. I note that argsort works both as a numpy function and as a ndarray method (the second is not mentioned as implemented but I observe it works), but the kwarg kind does not seem to be supported.

My question here is: is any numpy optional kwarg supported in pythran? Could the documentation specify this or which ones are supported?

pythran 0.12.2

Thanks!

serge-sans-paille commented 4 months ago

We have kwarg support in Pythran, both at user and package level. It relies on the inspect module to automagically discover values, and sometimes need a bit of help from the compiler. Let me have a look for argsort.

serge-sans-paille commented 4 months ago

ok, in the case of numpy.argsort it's just that I haven't added support for the kind keyword argument in pythonic (the native backend). inspect does its job as expected (otherwise you'd get a syntax error because kwargs are statically checked).