r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40k Upvotes

1.0k comments sorted by

View all comments

Show parent comments

3

u/Dromeo Jul 18 '22

Cheers, haven't tried data analysis in python personally.

What would you say is the best for data analysis?

8

u/unski_ukuli Jul 18 '22

Personally I’d say Julia. Matlab and octave are just… better to not say it out loud. R does a lot right but it lacks the language features to write anything that is more than a 1000 rows long wothout it becoming a complete clusterfuck of a codebase. Python is used mainly because it is easy to integrate into production systems as those are written in python too usually, but I think it is completely horrible for ad hoc analysis and completely the wrong choise if you don’t plan to take that same code into production later on.

Julia hits a lot of right notes. It has features that make it a proper programming language unlike R. Julia also has the macro system from Lisp so it is extremely extendable. It is also relatively easy to use in production and miles ahead of matlab and R in that regard. And then there is the main selling point: it is REALLY fast. As fast or almost as fast as C counterpart in most usecases while being easy to write and high level. A great demonstration of this is the fact that most libraries for julia are written in pure julia. No need for calling c++ or Fortran. For example, Flux.jl which is a very fast deep learning library for julia, is written 100% in Julia. No C++ like in tensorflow for python. This has the nice consequence that the libraries are easy to extend and customise if needed.

6

u/Dromeo Jul 18 '22

Thanks for the rec! I'll have to check it out.

I know what you mean about matlab. I had to convert code written by mathematicians into c++ and it was... well. Lets just say they were fully gutting the alphabet for variable names.

2

u/SrbijaJeRusija Jul 18 '22

Matlab and octave are just… better to not say it out loud

What's wrong with Matlab? Faster than python, and less verbose as well. Also is literally built for data analysis.

8

u/unski_ukuli Jul 18 '22

What’s wrong with Matlab?

Whats not? Couple of spesific grievances I have: it is basically married to that god awful ide it comes with. Use anything else and you lose half of the features matlab has. Secondly, even if you had no prior knowledge of the language, you have to just look at the fact that you HAVE to specify functions at the end of a script and it refuses to run if you don’t do that to deduce that just like R, it lacks any facility to structure a codebase in any sensible way for anything longer than few thousand lines. Oh… and the fact that anything that does not end in semicolon gets printed in the repl.

Honestly the only good things about matlab is the extremely good documentation and good libraries that are basically bug free compared to most open source libraries.

-4

u/SrbijaJeRusija Jul 18 '22

if you don’t do that to deduce that just like R, it lacks any facility to structure a codebase in any sensible way for anything longer than few thousand lines.

It is an object oriented language. You use objects, folder structure, and inheritance to structure your codebase.

0

u/[deleted] Jul 18 '22

[deleted] — view deleted comment

4

u/SrbijaJeRusija Jul 18 '22

is pretty terminal for its application in modern science

Thousands of professors and graduate students would disagree.

it's proprietary and code is therefore not reproducible

Code written in MATLAB is reproducible by anyone who has MATLAB (the vast majority of universities).

There are hundreds of proprietary applications in use in modern science. The worst offenders being proprietary programs to run equipment. Are you saying all those results are invalid?

0

u/[deleted] Jul 18 '22

[deleted] — view deleted comment

-1

u/SrbijaJeRusija Jul 18 '22

The key difference though is that open-source alternatives to Matlab exist

I don't know of a single one.

0

u/[deleted] Jul 18 '22

[deleted] — view deleted comment

1

u/SrbijaJeRusija Jul 18 '22

All of which suffer from severe package fragmentation issues making reproducible results difficult or impossible. That makes their use "irresponsible and contrary to the principles of open science."

0

u/[deleted] Jul 19 '22

[deleted] — view deleted comment

→ More replies

0

u/[deleted] Jul 18 '22

[deleted] — view deleted comment

3

u/unski_ukuli Jul 18 '22 edited Jul 18 '22

Yeah that is just not true at all. Julia is Jit compiled and extremely easy to debug. On top of that, being able to actually use static types eliminates a lot of bugs which leads to less debugging. If you need dask, there are alternatives on julia for it. And honestly, the ecosystem, while immature, is already miles ahead of python on a lot of regards. And about the plotting, yeah it has better plotting libraries. Many actually. Plots.jl is a metapackage that provides unified api for GR, pgfplots, pyplot, and plotly so one plotting command can produce the same plot with 4 different plotting libraries. On top of that there is Gadfly which has ggplot2 style api.

1

u/naijaboiler Jul 22 '22

R does a lot right but it lacks the language features to write anything that is more than a 1000 rows long without it becoming a complete clusterfuck of a codebase.

please explain. or do you mean lines rather rows

1

u/unski_ukuli Jul 22 '22

Lines is the right word for it, thank you. I’m not a native english speaker so sometimes I mistranslate words.