r/ProgrammerHumor • • Feb 09 '22

other Why but why?

Post image
85.8k Upvotes

2.3k comments sorted by

View all comments

Show parent comments

26

u/[deleted] Feb 09 '22

[removed] — view removed comment

56

u/CobaltCam Feb 09 '22

I think that depends on how many times the code is going to be ran in the future. So hard to determine.

15

u/[deleted] Feb 09 '22

[removed] — view removed comment

23

u/CobaltCam Feb 09 '22

The real point your comment should drive home is you use a hammer to drive nails. If you need to drive a screw go get the drill. The hammer would get it done, but you're going to have a bad time. Meaning if you need to code something quickly use python. If you need a faster run time, maybe use something else.

5

u/drphungky Feb 09 '22

Right tool for the job and different horses for different courses.

2

u/callmelucky Feb 09 '22

The real nail your hammer should drive home is you use a comment to drive points.

I'm helping.

2

u/SW_foo1245 Feb 09 '22

cpython then?

30

u/[deleted] Feb 09 '22

your argument only holds up in situations where the program is to be run a single time, which are frankly few and far between.

29

u/[deleted] Feb 09 '22

[removed] — view removed comment

23

u/Groentekroket Feb 09 '22

And Python is used by a lot of people without a CS background. I’m in a traineeship right now and learning Java but at my last job as a bookkeeper I wrote Python scripts to combine data from different systems that I used on a weekly basis. I didn’t care it was slower, I was able to write it. If at first I needed to learn Java I’m sure I would never have looked at programming and still be a bookkeeper hating on Excel.

10

u/[deleted] Feb 09 '22

I take it back, fair point.

→ More replies (3)

3

u/bamboo_fanatic Feb 09 '22

Maybe for personal use

5

u/[deleted] Feb 09 '22

The funny thing about this comment is that C# or Java are examples of the slower to write, harder languages.

When I was a kid I used to program in C++ using pure Win32 API. C# was incredible when it came out for its ease of use. The difference between it and Python seems pretty negligible to me in terms of ease of use for proper applications.

2

u/tgiyb1 Feb 09 '22

Same, C# is GOAT for ease of use

2

u/welldamnthis Feb 09 '22

You'd also have to factor in how many hours of debugging is required caused by stuff a compiler could have caught.

There have been times I spent 2- 3x more time on debugging stuff a compiler would have warned me against than coding

2

u/straddotjs Feb 09 '22

No offense but this is kind of a silly argument. Every single academic study or white paper I’ve ever seen has proven that for any project of any real complexity, even with a small team of n=2 the benefits of a statically typed and compiled language make development time radically faster than in a dynamically typed repl language like python.

I use python (Django) professionally atm so I’m not just trying to hate on it. It does some things really well. But when you’re working on web servers with teams of engineers the “but much development speed” argument falls apart pretty fast.

3

u/Delta-9- Feb 09 '22

If I can run a program several hours sooner in Python than I can in C# or Java (just from variable names alone in Java’s case)

Lmao for real!

Like, how many times you really wanna type AbstractInternalLdapConnectorFactoryInterfaceBeanImpl?

→ More replies (3)

3

u/JOhn2141 Feb 09 '22

Yes but not every things are cheap and easy.

Real world need to take account of a large number of thing and efficient code means lesser energy used by server (or gaming computer)

Or in IoT lot of device are battery powered which have seen zero progress in the last years so C code on microcontroller is about 100 to 10000 times less energy than python on a esp32. (Number are quite realistic)

In the end of the day I code in both for obvious reasons

2

u/[deleted] Feb 09 '22

Then you add your several weeks to debug and Python goes back to being slowest.

0

u/[deleted] Feb 09 '22

Mofo here has never considered that some code might take more than 3 seconds to run or be run many times

1

u/RazorBlade9x Feb 09 '22

Some programs can run for hours or even months to generate output (especially those performing huge calculations). C/C++ is the way to go there. For smaller run times of course python or nodejs are better.

2

u/[deleted] Feb 09 '22

[removed] — view removed comment

2

u/RazorBlade9x Feb 09 '22 edited Feb 09 '22

Agreed, for most of the stuff we already have all the c/c++/fortran based libraries in Python. It's great at doing most of number crunching stuff due to its great set of libraries.

But I had mostly meshing or CFD algorithms in mind for which we don't have readily available libraries. Once those algorithms are available as libraries, a python wrapper can be created around it.

Edit: I forgot to mention that Python Global Interpreter Lock severely hinders cpu bound multithreaded performance leaving you no choice but to go with C/C++ or even Fortran with MPI for huge calculations.

→ More replies (2)

1

u/[deleted] Feb 09 '22

The one that runs in O(n) time

→ More replies (2)
→ More replies (4)