Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Switch to Julia! Hit @edit unique([1,2,3,2]) in the REPL and you see the implementation.


Nice! Ive been meaning to try out Julia for a while now. Is the numpy equivalent in Julia largely written in Julia itself? (as opposed to C/Fortran)


Julia's numpy equivalent is basically the standard Array type from the standard library, which I'm 99% sure is native Julia.


If one is working on small (<= 15 by 15) matrices, the StaticArrays module [1] is also native Julia and is much faster than Base.Array. Since a StaticArray knows its own size after type inference, they are allocated on the stack, which is nice.

One downside is that unless you're doing BLAS-style operations, writing non-trivial transformations of StaticArrays always seems to require generated functions.

Anyway, I think this is a feature that numpy doesn't provide.

[1] https://github.com/JuliaArrays/StaticArrays.jl


You can do the same thing in IPython/jupyter with ?? e.g.

np.unique??


That only works for functions written in pure Python though, right? Although having said that I'm not sure how many of the functions that you'd actually want to look at the source for are written in C/Cython/Fortran.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: