Python-Julia cheat sheet?

I am new to Julia but well-versed in Python, and was wondering if there is a Python to Julia mapping chart (similar in concept to this SQL to MongoDB mapping chart: https://docs.mongodb.com/manual/reference/sql-comparison/)?

1 Like

See Noteworthy differences from Python.

1 Like

The QuantEcon cheetsheet may be useful as a quick reference, but nothing replaces actually reading the documentation :wink:

7 Likes

just to add more reference:
https://github.com/JuliaCN/Py2Jl.jl

Thank you! This is by far the best Python-Julia cheatsheet I have seen.

Thank you, but I’m not exactly sure how this is relevant to the question.

you want to (learn to) translate Python code to Julia code, this does that for you automatically?

1 Like

If you really want to do a 1:1 transpile from python to julia, you should be aware of the limitations of such transpiled code, as explained in the FAQ section of the docs:

Why don’t you compile Matlab/Python/R code to julia?

The short version is - it’s the semantics of julia that makes it fast, not the syntax. A pure transpilation will most likely not take full advantage of those and is in fact likely to be slower, because certain patterns used in those languages are simply not efficient in julia (reasons for this include spurious allocations of memory on the heap, garbage collection, access patterns and more, all of which and more can be avoided by writing more idiomatic julia code).

3 Likes

No. I wanted to use a reference for when I need to understand something in Julia since I already know Python. I don’t need to automatically translate from julia to python. A good analogy would be using Google Translate for every sentence you want to say when your objective is to learn how to speak the language; which is not what I’m looking for. I’m thankful for your comment though!

1 Like

that’s on me. I changed the title (way earlier), the original title was “mapping”, which I interpreted as some kind of well defined operation to map a python function to julia function so I assumed it meant something automatic.

1 Like

Anyone know an easy-to-read version of this? I’m lecturing Numerical Analysis in January to 2nd year undergrads who have only been exposed to Python and I’d like to make it as easy for them to pick up as possible

See https://cheatsheets.quantecon.org/ and submit PRs if things are out of date!

2 Likes

this is the best reference I have found so far: https://cheatsheets.quantecon.org/

That is an amazing reference! Absolutely perfect. Thanks!!

There is another one which provides some equivalent expression between multiple languages (Matlab, Julia, Numpy, and Eigen)

https://www.thewizz.art/2022/01/05/matlab-equivalent-functions-in-julia-numpy-and-eigen/

1 Like