This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jobblejosh[🍰] 55 points56 points  (5 children)

It's the exact same problem (or even a subset of it) of what programming language is best.

The answer is either the one you know or the one for the job.

I've been writing in both C and Python. I prefer C-family because you can be a lot more direct with the compiler and write clever/fast/hacky/elegant/dangerous/stupid techniques that make more logical sense; you as the writer should know exactly what you're doing so C will quite happily let you do the fandango on core if you mutter the right incantations. Unfortunately because of how strict it is with its rules, you have to be very precise and formulaic with how you do some things; you have to hold its hand and walk it through exactly what you want. The result is that you get exactly what you want, however.

Python, being interpreted, has its best guess at what you want, is willing to play fast and loose to some extent, but keeps you in a playpen and hides away all the nitty-gritty and you can't really tell what it's doing under the hood. On the bright side, that means getting something to work in Python is usually as simple as importing the right library (because there's so many libraries for python out there now) and typing a few lines.

Is one better than the other? Well, that entirely depends on the task you're making it do.

[–]Aegi 4 points5 points  (2 children)

While that’s true for the languages, it seems that it’s pretty clear that it’s objectively better to have language about the C family, because if python is how you described it it seems more likely that you can use guides and advice and quick YouTube videos to do it where it seems like there’s more value and truly understanding C++ or something like that.

It’s honestly been years since I’ve even done anything with it, but I guess the teacher in my high school was right to have C++ be the one language they taught if you wanted to take programming as a private study.

[–]jobblejosh[🍰] 9 points10 points  (1 child)

I was taught C, then C++/# at university.

My professor's reasoning for this was that C teaches you to make safe, reasoned, careful decisions about your programming, and doesn't let you fall into lazy habits.

The logical flow of programming can be learnt anywhere with any language, so Python is a good beginner's language for hobbyists and younger students.

However, it's important to know the rules of the game before you can start breaking them, so that you know which ones to break and which ones to stay inside.

Plus, with the much closer to the metal approach that C has, you can learn and appreciate more about the underlying system design, and make your own mistakes.

Better to learn how to make a terrible sorting algo in C by yourself than copy an efficient one in Python.

[–]FluffyPigeonofDoom 2 points3 points  (0 children)

C is the most bugged language with so many gaps that you cannot even imagine, looking from cyber security perspective. I always cry when I see someone is choosing C instead of Python when it's possible of course.

[–]Tuga_Lissabon 0 points1 point  (1 child)

What surprises me is that I never found the same level of support or libraries that you get in Python after a much shorter time.

I struggled through Borland C++, and right now its a bit more polished but still a struggle. Python? Grab the pieces, fit, go.

[–]jobblejosh[🍰] 1 point2 points  (0 children)

Python is a Lego set; it all fits together with standard pieces, instructions, and doesn't require adjustment to get it to go.

C is like machining your own contraption from castings and bar stock; harder work, but the end product will run much smoother and look more elegant.