# Python porting to Julia resources

**URL:** <https://discourse.julialang.org/t/python-porting-to-julia-resources/31953>\
**Category:** Machine Learning\
**Created:** [December 7, 2019, 12:42am UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953 "2019-12-07T00:42:00Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 21, 2020, 6:45am UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/21 "2020-03-21T06:45:56Z")

</div>

I think it would be best to just follow the current layout (a bunch of bullet points). Maybe organize them a bit by topic.

Also, I am not sure that constructing a very detailed “dictionary” (function names etc) is either feasible or desirable. After all, they are two different languages. The focus should be on conceptual issues.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [March 21, 2020, 7:53pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/22 "2020-03-21T19:53:50Z")

</div>

Some enhancements to my table (on Gist because it became too long for this thread).

> <https://gist.github.com/lungben/a084e3e2da32ae95f17612b008e8a702>

I agree that the conceptual / code structure parts are most important. Imho the largest syntactical difference between Python and Julia is classical OOP classes vs. structures and multiple dispatch. This point is not yet included in the Noteworthy Differences.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [March 25, 2020, 6:04pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/23 "2020-03-25T18:04:43Z")

</div>

I am preparing a PR for additional points into the documentation.  
Is it OK for you if I include your points, too?

---

<div class="post-metadata">

**Author:** ![raff](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@raff](https://discourse.julialang.org/u/raff)\
**Post date:** [March 25, 2020, 6:54pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/24 "2020-03-25T18:54:21Z")

</div>

Sure. please add them to the PR.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [March 25, 2020, 7:26pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/25 "2020-03-25T19:26:52Z")

</div>

Thanks.

Here is my first version (including the points of @raff):  
[https://github.com/lungben/julia/blob/patch-1/doc/src/manual/noteworthy-differences.md](https://github.com/lungben/julia/blob/patch-1/doc/src/manual/noteworthy-differences.md)

I am happy to invite more collaborators!

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 25, 2020, 9:16pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/26 "2020-03-25T21:16:25Z")

</div>

In Python `0`, `None`, empty list are evaluated to logical `False`. In Julia, you need explicit conversion to Bool.

In Julia, a new local scope is introduced by most code blocks, including loops, `try-catch-finally`, and comprehensions.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [March 26, 2020, 8:34pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/27 "2020-03-26T20:34:46Z")

</div>

Thanks, good points. Adding them.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [March 26, 2020, 8:55pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/28 "2020-03-26T20:55:59Z")

</div>

Created a PR  
[https://github.com/JuliaLang/julia/pull/35268](https://github.com/JuliaLang/julia/pull/35268)  
Thanks for your suggestions, comments and additions to the PR are welcome!

---

<div class="post-metadata">

**Author:** ![mig](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mig/32/36443_2.png) [@mig](https://discourse.julialang.org/u/mig)\
**Post date:** [August 10, 2022, 8:41pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953/29 "2022-08-10T20:41:56Z")

</div>

I’m very late to the discussion, but maybe it is also worth mentioning that there are some transpilers that translate a subset of Python to Julia:  
Py2JL: [GitHub - JuliaCN/Py2Jl.jl: Python to Julia transpiler.](https://github.com/JuliaCN/Py2Jl.jl)  
Py2Many: [https://github.com/py2many/py2many](https://github.com/py2many/py2many)  
FromPython: [https://github.com/kskyten/FromPython.jl](https://github.com/kskyten/FromPython.jl)  
(Disclaimer: I am currently contributing to develop Py2Many)

This might also be related to the following discussion: [Python to Julia transpiler](https://discourse.julialang.org/t/python-to-julia-transpiler/21473)

[Previous page](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953.md?page=1)
