5
$\begingroup$

I want to apply for a position after my PhD in an industrial laboratory that does research in OR. They stipulate that they want either Python or Julia programming languages. Since my Bachelor's internship supervisor taught me Julia 5~6 years ago and I liked it, I did not really get a look into Python and kind of begin to become more and more used to Julia.

However, as I do not know much about Python, I would like to know what are the pros and cons for such a position for either Julia or Python. I believe that if a position wants Julia, you should not considered that much Python and vice-versa and my question should be answered only if both languages are suggested in the position. As I would not prefer asymmetrical answers and would like objectivity, I suggest that all answers contains the two sections:

  1. Pros and Cons of Python over Julia in OR industry laboratory interviews
  2. Pros and Cons of Julia over Python in OR industry laboratory interviews

Some of the pros and cons I have in mind is that Julia is relatively new and its community too. So, many questions about Python have been asked in StackOverflow. This is not really true for Julia. Also, as mentioned in this answer, there are many cutting-edges packages developed for JuliaOPT. Finally, Julia is known to be generally faster though Python can also be fast if you correctly use the appropriate packages.

What else you should mention in such an interview?

$\endgroup$
1
  • 3
    $\begingroup$ If a question behind your question is "Should I learn Python?", the answer is "yes". You'll very likely need to use Python sooner or later, so better learn it now. And you'll arrive at the interview with the knowledge of both languages $\endgroup$
    – fontanf
    Commented Dec 28, 2022 at 16:27

4 Answers 4

3
$\begingroup$

To the risk of stating the obvious: the person best-positioned to answer is the person who will interview you. Job postings will often list a few programming languages to encourage many candidates to apply; you may end up coding in Java and GAMS...

As already noted, the Julia vs Python question has no universal answer other than "it depends." The environment you work in, people you work with, legacy codebases... are as important (if not more important sometimes) than a language's raw features. There is nothing you can do Python than you cannot in Julia, and vice-versa; in my experience it's often more about "how fast can you make it happen?" and "how easy is it to use?", the answer to which depends heavily on your familiarity with each tool. There are some great answers about the pros and cons of each programming language on this forum:

$\endgroup$
1
  • $\begingroup$ I think this is the answer that suits the most my wondering :) $\endgroup$
    – JKHA
    Commented Jan 9, 2023 at 20:12
4
$\begingroup$

Answers will probably be very opinionated and it also depends on what kind of research (and possible adoption of that research) you are targeting.

Disclaimer

I did not use Julia for a long time (and it's obvious, that i prefer Python). This is probably no fair comparison and i don't want to talk down julia. Also consider that my background is CS, not Math and i never did academic research but only did work in the industrial context.

So from the top of my head:

Pro Python

  • It actually is a (well-)supported language in all commercial sovers while Julia might not be
    • See Gurobi and co.
    • Yes... There are lots of good community-provided libs, but official support is (sometimes) hard to beat
  • The ecosystem is much bigger:
    • Lots of great software to make use of
      • Even software not related to optimization but extremely helpful in research anyways like matplotlib or pandas; why use 2 languages at work if 1 can be enough
  • The community is much bigger
    • This might also be the case in your local colleague-community
      • (If there is a lingua-franca in programming: it's probably C for system-languages and Python for interpreted-languages)
  • Better foreing-language tooling (i guess; see disclaimer)
    • e.g. pybind11 / cython
    • Python/C++-Hybrids are imho the perfect combination
      • Performance can be optimized where it matters (e.g real computational work needed within some cutting-plane callback)
      • State of the art libraries can be used when needed
        • Example: I frequently make use of Eigen / boost::graph which i consider both state of the art in their respective domains
  • There are no JIT(Julia!)-related performance surprises (which are hard to predict)
    • e.g. multi-second pause in your program because that function hasn't be compiled/optimized yet
    • no fun at all when doing benchmarking
  • 0-indexing if you like it (and you will if you touch any other programming-language; i'm ignoring matlab)
  • Python will definitely stay relevant for many years to come

Pro Julia

  • Good (advanced) research community
    • From the top of my head: decomposition-methods; (specialized) interior-point solvers; first-order solvers (although at some point people consider porting them; e.g. Googles PDLP which was POCed in Julia and then ported to C++ based on Eigen)
  • Better performance on tight loops
  • Multithreading-support
    • No personal experience with it; but Python's GIL can really by annoying
      • At that point hybrids help again (as you can acquire/release the GIL in your native-code)
  • (Better languaged-provided tooling for abstraction from what i heard)
  • 1-indexing if you like it

No clue but maybe important

  • Type-system (i believe in type-systems catching hard-to-debug bugs early)
    • Both seem to make use of optional type-hints but i don't know how powerful / accurate it's used
    • This is relatively new in Python and there sure are limitations

Personal Opinion: Missing tooling

If they ask about Python/Julia without some C/C++ knowledge, it's probably very research- or modelling-focused as i don't see these two languages providing what's needed to really exploit all those available features of existing software has to offer. (All the commercial solvers are C/C++-based)

So maybe all points related to performance or getting access to all the solver-features might be unimportant.

Skimming over your linked answer, it seems, that this low-level access is irrelevant for lots of people (which get the work done using Python alone for example). So maybe i'm the outlier here. Although... SCIP always seemed to be the dominating research-focused solver (when going into depth of such technology; so more low-lvl then modelling) and it's probably hard to make use of it without C/C++.

Additional remark: I consider Python relatively easy to learn and i don't consider it a year-long task to get working. This might be nearly the same for Julia (but won't be for C++).

$\endgroup$
2
$\begingroup$

If either-or choice is there simple answer would be that you are comfortable in Julia and have worked out functioning code.
Many interviewers appreciate the confidence that you display when you communicate your comfort level. But do display some scope to learn Python, Ruby etc if asked.
At the end in large corporates a PhD researcher would be expected at best to develop prototypes of the proposed models. For production there will be full stack python developers in their application development team. But you would need to communicate and express your model and it's characteristics via functional diagrams, specification notes and prototype code.

$\endgroup$
1
$\begingroup$

Very opinionated answer too. I think the big cons of Julia are that its ecosystem and community are currently smaller than Python. If this is important or not, it will depend on the kind of research to do. If, for example, you will have to prototype heuristics or model math programming problems, Julia looks better. Anyway, I suggest spending some time learning Python. There is no silver-bullet language and, currently, both interop very well.

$\endgroup$
1
  • 3
    $\begingroup$ There's an OR research scholar Oscar Dawson. You can contact him to know what more you can do with Julia/JuMP. He is on stackexchange. $\endgroup$ Commented Dec 29, 2022 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.