"Python is undoubtedly faster in helping programmers express their concept in fewer lines of code"

https://content.techgig.com/julia-vs-python-which-is-best-for-data-science/articleshow/77832810.cms says “Python is undoubtedly faster in helping programmers express their concept in fewer lines of code”.

Really? I find Julia can express mathematical ideas very succinctly, it’s almost literal translation of algorithm straight into code. I find it quite the opposite actually - Python code tend to be a bit more verbose due to numpy syntax.

What do you think? What’s your experience been?

10 Likes

I think you will find most people on this website consider Julia to be better. Julia is one of the most (if not the most) expressive programming languages.

Python is a bit ugly in my opinion, but I don’t mind that some people still prefer it, that’s up to them.

19 Likes

These kind of sentences makes me wince. If a program is faster (in terms of human coding), then they may not have as few lines of code as python, and if a language can express the same thing in fewer lines then they can argue that it takes longer to come up with these shorter lines.

It’s too good a cover. I think more precise language is called for.

1 Like

Only because of the end keyword :wink:

In my experience, Python and Julia code is mostly similar in size, with Julia often be slightly shorter / easier.
If performance matters, Julia code is usually much simpler than Python, because special techniques (like vectorization, Numba, etc.) are required in the latter.

4 Likes

Unbalanced code with the omission of ends always hurt my eyes. Our ancestors had good reason when they wrote end do, end if, end function, end program, etc. Short code can be horrible for both humans and machines, look at this:

(lambda f, n: f(f, n))(lambda f, n: [(not n % 3 and "fizz" or "") + (not n % 5 and "buzz" or "") or n] + f(f, n+1) if n <= 100 else [], 1)

Or this:

from itertools import cycle 
(x or n+1 for n, x in enumerate(map(''.join, zip(cycle([''] * 2 + ['fizz']), cycle([''] * 4 + ['buzz']))))) 

Of course one can write bad code in any language, but the languages are, in large part, those who give people permission to do so.

4 Likes

Keep in mind that this is a <300 word blurb. I am not sure this is worth discussing; it is similar to the filler material on the back page of tabloids (“scientists find that <X> causes/cures cancer”).

15 Likes

It’s a strange sentence to me. Is the implication that it takes longer to learn how to use fewer lines in Julia? Also I don’t think writing fewer lines of code is a very good goal in general. I don’t write

julia> for i in 1:10;println(i);println(i^2);end

very often even though it reduces the number of lines from the way I usually express this by a lot.

I don’t have much experience in Python but I spent years in R learning shorthand syntax for packages like data.table to get performant code. Way fewer lines, much longer learning time, not easily understood by people who do not know the package.

EDIT:
See also the last sentences:

The programming language is used by Google as a research language. Julia in combination with Google’s hardware Tensor Processing Units was the best combination for fast and easily expressible machine learning computation.

I guess this was written by GPT-3.

7 Likes

Could be! It makes me wonder if this quote from @viralbshah is genuine:

If you are building a new search engine that’s heavily mathematical, or trying to predict the weather, or discovering a new bug, that’s where you use Julia. But if you are building a mobile app, Julia is not an answer to that. It’s for very large data sets, and where you are building a complex algorithmic application.

Using Julia to discover a new bug?

I think the claim is that python is less verbose than Julia, which seems way off to me. But the linked article is of such modest ambition and quality, that I don’t think there’s much point in over-thinking it.

1 Like

I think the context for “bug” (= pathogen) here is medicine.

1 Like

I agree within the Julia discourse community the article is not worth much discussion, I prefer Julia over Python for scientific work any day of the week.

I don’t know how the author formed that opinion or where they got the information from, it bothers me when the public at large sees these articles that can potentially give them the wrong impression.

yeah.

totally get you.

as a community we can put out more positive content. i think their point might resonate with some ppl as well. So I guess it’s about knowing such sentiments exists, but work to change things we can improve would be my general approach.

3 Likes

It shouldn’t — people are free to write what they like, we have no control over this, which is fine.

What you have some control over is whether to disseminate this kind of information (eg by discussing and linking to it, Google will rank it higher). If these kind of articles bother you, it is just best to ignore them.

9 Likes

I hated about Python that it creates clumsy gigantic code when you are doing complex math … I only looked at Julia because Julia helped me express my concepts in fewer lines of code. It took me a few hours from my start at learning Julia to completely porting three months worth of python code … only requiring 1/10 of the code length.

10 Likes

… and I have become a true believer!

2 Likes

I’m a mathematical epidemiologist (topical at the moment…). I only found Julia because I was looking for a language to code in when I wasn’t do something “serious” in C++. Hated the R syntax, looked at Python and got bored having to think hard about vectorisation even to do something “non-serious”.

Basically, googled “Is there a language that is like Python but isn’t crappy” and found Julia 0.6.

I struggle with the idea that there is enough difference between the high-level syntax of Julia and python that anyone would really prefer one to the other. Julia steals all Python’s syntactic sugar.

10 Likes

Programmers are fanatical about what type of whitespace they use. every character of difference apparently is enough to inspire revulsion.

3 Likes

I am still waiting for someone to design a language where various forms of whitespace have different meaning.

Julia wasted perfectly good opportunities to be wacky with whitspace. In particular, the MONGOLIAN VOWEL SEPARATOR (U+180E) should utilized for some crucial piece of syntactic distinction as it is both tricky to input and invisible in a lot of IDEs.

7 Likes

Why would you think nobody has done this yet? :wink:

3 Likes