Why can't Julia hold a python?

Julia's syntax is very similar to python, while the concept of the class (if you should consider it as such) is more than what you use in C. There were many reasons why the creators decided the difference with respect to OOP. Still, would it be so difficult (compared to creating Julia in the first place, which is impressive) to find some canonical way to interpret python for Julia and thus take hold of all python libraries?

+4
source share
1 answer

Yes. The design of Python makes it fundamentally difficult to optimize at compile time (i.e., before running the code). It's just not true that Julia is fast BECAUSE OF JEET. Rather, Julia is designed with a type system and multiple dispatch, so the compiler can find out all the necessary details to compile "the same code that you would write in C". This makes it fast: type system. He makes several compromises that allow him, in "type-stable" functions, to fully determine the types of each variable, to know what the type memory layout should be (including parametric types, therefore it Vector{Float64}has a memory layout that is determined by the type and its parameter, which embeds values Float64, such as a NumPy array, except that it generalizes like this,what are your own typesstructget the same efficiency) and compile a version of the code specifically for the types that are visible.

, Python. , , , , , . , , , , , ( . , , , Python). : "", . Python/MATLAB/R , . , "" , Julia, .

, Numba? Numba , , Python, , , . . , Python. , Python , , . , Numba , , . , , . " ", , , , " , , ". .

, , Python - . , Julia Python, .

, . , , ", Python", .

:

http://ucidatascienceinitiative.imtqy.com/IntroToJulia/Html/WhyJulia http://www.stochasticlifestyle.com/7-julia-gotchas-handle/

http://www.stochasticlifestyle.com/type-dispatch-design-post-object-oriented-programming-julia/

+15

Source: https://habr.com/ru/post/1680661/


All Articles