Poll of the Day > What advantages does C have over Python, other than speed?

Topic List
Page List: 1
EclairReturns
04/26/22 1:31:25 AM
#1:


I am aware that Python is interpreted, while C is compiled, which makes the latter objectively faster for a computer to run. I've heard also that C is better-suited for hardware-related tasks. As a beginner to C, I've found C to be far less flexible than Python. Granted, I've not done many projects in the former, and as such, would not have knowledge of how to perform a given task in C that I could easily perform in Python. In any case, speed and hardware-interactivity aside, are there any advantages that C offers that Python does not?

I must have these answers.

---
Number XII: Larxene.
The Organization's Savage Nymph.
... Copied to Clipboard!
wolfy42
04/26/22 1:52:55 AM
#2:


Python does not have a goto command which is a big deal for older programers/coders and can make some programs (especially simple ones) more complicated and longer.

It's a main reason I don't like Java either, as call outs are not as easy/simple as goto, and especially for fast small programs you generally have a much more complicated method than with C, Basic etc.

Some people prefer call outs etc, and it can make it easier for multiple people to write one piece of code etc, but honestly we did fine with goto back in the day and I still prefer a language that supports it.

---
Tacobot 3000 "Saving the world from not having tacos."
Friends don't make their friends die Hanz. Psychopathic friends do.
... Copied to Clipboard!
Dikitain
04/26/22 4:12:39 AM
#3:


The big one that pops into mind is that C gives you more options for memory management than Python. Like in C, you have no problem accessing specific memory locations on your computer while in Python you are running in a virtual environment and therefore only have access to the memory that the operating system has given you.

That said, comparing C and Python is like comparing a lawn mower and a rake. They are really two different tools. Python is meant for quick, scripted programs while C is more for low level software like operating systems or hardware drivers. It is better to compare Python to something like Perl, which in that sense it is better in pretty much every conceivable way.

wolfy42 posted...
Python does not have a goto command which is a big deal for older programers/coders and can make some programs (especially simple ones) more complicated and longer.

Goto statements also became almost impossible to maintain once coding even medium sized programs became a thing. Plus you can't really reuse a lot of code that has goto statements in it, meaning you are probably duplicating a lot of what you are writing.

Considering even a "small" program can be thousands of lines of code, having to trace the flow of a couple hundred goto statements is a nightmare.

---
After 16 years, I have decided my signature will NOT be about my job! But I still don't know what to put here so...yea...
... Copied to Clipboard!
wolfy42
04/26/22 4:19:08 AM
#4:


Dikitain posted...
The big one that pops into mind is that C gives you more options for memory management than Python. Like in C, you have no problem accessing specific memory locations on your computer while in Python you are running in a virtual environment and therefore only have access to the memory that the operating system has given you.

That said, comparing C and Python is like comparing a lawn mower and a rake. They are really two different tools. Python is meant for quick, scripted programs while C is more for low level software like operating systems or hardware drivers. It is better to compare Python to something like Perl, which in that sense it is better in pretty much every conceivable way.

Goto statements also became almost impossible to maintain once coding even medium sized programs became a thing. Plus you can't really reuse a lot of code that has goto statements in it, meaning you are probably duplicating a lot of what you are writing.

Considering even a "small" program can be thousands of lines of code, having to trace the flow of a couple hundred goto statements is a nightmare.

Yeah, I have not coded much in decades at this point. Used to code on muds, created a few games in the 90's etc, but I did code a bit using Java etc, didn't really like it and just stopped all together eventually. I know goto commands are not missed by almost anyone, but it's what I was used to and it's hard to make the switch.

---
Tacobot 3000 "Saving the world from not having tacos."
Friends don't make their friends die Hanz. Psychopathic friends do.
... Copied to Clipboard!
11110111011
04/26/22 8:06:22 AM
#5:


C allows you to work at a low level and can run much faster in applications where speed and efficiency matter.

Python has a bunch of BS on top of it. Your minimum program size and memory allocations will be very large compared to C.

TLDR - if you are working on software for PC, python will be ok most of the time. If you are working on a robot or embedded system, C will allow you to run more code with less overhead.
... Copied to Clipboard!
Krazy_Kirby
04/26/22 9:31:28 AM
#6:


it won't eat its tail

---
Kill From The Shadows.
https://en.m.wikipedia.org/wiki/Idiot
... Copied to Clipboard!
kind9
04/26/22 9:36:27 AM
#7:


I don't know for sure but I would assume C has a larger variety of 3rd party libraries. Python has so much extra functionality built into its own standard library.

---
http://i.imgur.com/NkZUeFd.gif
... Copied to Clipboard!
Dikitain
04/26/22 9:59:30 AM
#8:


kind9 posted...
I don't know for sure but I would assume C has a larger variety of 3rd party libraries. Python has so much extra functionality built into its own standard library.

Python probably has way more at this point.

But neither of them even come close to Java. Hence why I don't think anything is ever going to replace JVM based languages (Java, Kotlin, Scala, Groovy, etc.)

---
After 16 years, I have decided my signature will NOT be about my job! But I still don't know what to put here so...yea...
... Copied to Clipboard!
#9
Post #9 was unavailable or deleted.
Yellow
04/26/22 1:16:08 PM
#10:


Honestly, C is an ancient language and it would be a waste of time to learn these days.

C++ made it obsolete, and that's an ancient language. Programming languages age like cheese, not wine.

Python I've found doesn't really add as many benefits as people say but slows down your programs massively, I also find it much harder to use, and try to avoid it at all costs.

I do a machine learning project and find that the biggest bottleneck is the python code that parses the results, some of the most simple code, that's totally unacceptable tbh. The solution is to use a library that was compiled with something else through an API in python. That's some trash.

---
why am I even here
... Copied to Clipboard!
Judgmenl
04/26/22 8:56:51 PM
#11:


Python is not for performance, it's for ease of use. C and Python are basically opposites. One is a high level language with a strong OOP model and very pragmatic ways of writing it, and the other is as low as most people get these days, has no "real" standard, and gives you the best possible performance as you're as close to the "metal" as possible. Manual memory management is a very big deal, especially in one of my fields of expertise (High Performance Networking).

Nobody should ever consider using a language like Java or C#. They only had popularity due to either 90s-era design paradigms or because they're backed by Oracle/Google/Microsoft. C++ is almost at that point too way too much bloat, doesn't have a built in package manager, its tooling (if you go cmake or meson) is annoying.

wolfy42 posted...
Python does not have a goto command which is a big deal for older programers/coders and can make some programs (especially simple ones) more complicated and longer.
This comment triggered me, and Dikitain responded more professionally than I ever could.

---
You're a regular Jack Kerouac
Not removing this until I've left March 2020.
... Copied to Clipboard!
Yellow
04/26/22 10:17:59 PM
#12:


Judgmenl posted...
C#
Since we're arguing, C# is one of my favorites. In terms of getting something deployed, there's no faster way to do it, it gives you pretty much 90% of the speed you would have with C with 30% of the coding. Yeah, Microsoft's corporate staff is constantly changing it at the whim of a CEO with something to prove, which is annyoing, but it's still damn good a hybrid of simplicity and compiled code, and most of their recent choices have made it really good.

People hate it because of its garbage collector? Also, it was closed source back in 2010, but since then it's gone open source and will build for pretty much every platform.

Java/Python for me are just objectively worse than C#. Python is jank as fuck. I've written a ton of programs in python, the fact that I basically end up with 30 Google tabs open every time because it rarely comes with IntelliSense just makes it an absolutely awful experience.

Java is just an alternative to C#... except it's 8 times slower, and you have to fiddle with runtimes, I basically have no idea why it exists or why anyone uses it, but again, weird persistent fanbases. "It can run anywhere", dude, if someone has to write a Java interpreter for some hardware, they might as well just make it a freaking compiler.

Golang is something I'm looking at seriously, a lot of projects I know of are transitioning away from Python to Golang once finding out that it's cripplingly slow and makes their projects impossible (because they bought into the Python hype). If I ever step away from C# it's going to be for Golang.

Seriously. You can cut your line count by maybe 20% and make your program 10 times slower by using Python over C#. Won't even matter because there's a good chance you'll have to optimize the hell out of it.

Judgmenl posted...
This comment triggered me, and Dikitain responded more professionally than I ever could.
Yeah gotos are basically a do not use ever... and I learned with BASIC as my starting language.

---
why am I even here
... Copied to Clipboard!
Judgmenl
04/26/22 10:30:45 PM
#13:


Microsoft is just awful, and supporting them in any way is just toxic.
I have no idea why anyone would hate automatic memory management.

Java/Python for me are just objectively worse than C#. Python is jank as fuck. I've written a ton of programs in python, the fact that I basically end up with 30 Google tabs open every time because it rarely comes with IntelliSense just makes it an absolutely awful experience.
"The language I use is the best and all of the others suck".

Yellow posted...
Golang is something I'm looking at seriously, a lot of projects I know of are transitioning away from Python to Golang once finding out that it's cripplingly slow and makes their projects impossible (because they bought into the Python hype). If I ever step away from C# it's going to be for Golang.
I have used Go for around 5 years now. It is my favorite programming language and I don't see that changing any time soon.

Yellow posted...
Yeah gotos are basically a do not use ever... and I learned with BASIC as my starting language.
The one thing everyone should be able to agree with in this thread.

---
You're a regular Jack Kerouac
Not removing this until I've left March 2020.
... Copied to Clipboard!
Yellow
04/26/22 11:27:58 PM
#14:


You know what's funny, I wrote a huge program and codebase in BASIC which had no scope at all, all in the same file.

I wasn't having issues with it at all, it was just 10000 lines of SmileBASIC. I came up with an elaborate way to pass information between functions because I didn't know any better. I used an integer called 'u' for all "unused/throwaway" variables. Somehow I was able to remember the names of all my variables, and not once was there a glitch where something overrode something else.

Judgmenl posted...
"The language I use is the best and all of the others suck".
I'm more of an interpreted language hater, just on a fundamental level. I would be more open minded, really, but no one has been able to convince me why they should be used nor have I been able to convince myself. I see sandboxed code being useful for security, but not for the base of your server, it's silly.

I also hate SQL, but who doesn't, lol.

---
why am I even here
... Copied to Clipboard!
Yellow
04/26/22 11:39:11 PM
#15:


Also, my introduction to Java was at the age of 15 fixing it about a thousand times to play Minecraft, uninstalling and reinstalling, messing with the registry. If you installed the 32 bit version you couldn't use mods, so you had to dig deep into the details of their website and find the 64 bit version, which would double your framerate, and sometimes that would just corrupt other things, seriously I just hate Java.

---
why am I even here
... Copied to Clipboard!
Sahuagin
04/26/22 11:42:10 PM
#16:


most systems programming is done in C. most O/S kernels are written in C, including Windows, Linux and Mac O/S. the remaining parts of these not in C are in C++.

C is basically one step up from assembly (where it's pretty straightforward if you know and follow C conventions to write C code that calls something built in assembly, and vice-versa). you're "right at the metal" as they say, actually writing code that is (almost) directly executed by the CPU without a half dozen levels of abstraction in between. (you often can even write inline assembly. some of the first programs I wrote were games (or attempted games) using good old INT 10h in C).

wolfy42 posted...
we did fine with goto back in the day and I still prefer a language that supports it
unconstrained goto should not even be considered an option. constrained goto is maybe theoretically ok (that's basically what you use in assembly).

in modern languages, 99% of the time there's a better alternative, so using goto, even constrained, means you chose an objectively worse option for no reason.

---
The truth basks in scrutiny.
http://i.imgur.com/GMouTGs.jpg http://projecteuler.net/profile/Sahuagin.png
... Copied to Clipboard!
Sahuagin
04/26/22 11:55:41 PM
#17:


Yellow posted...
no one has been able to convince me why they should be used nor have I been able to convince myself
one of the main benefits of a fully interpreted language is that an interpreter is easier to write than a compiler. another one is device independence.

but Java bytecode or .NET JIT are close to being best of both worlds. they're fast like compilers, but still device independent.

also, rather than having to have a different compiler for each combination of platform and language (NxM), you only need one JVM/JITter per platform and one compiler per language (N + M).

I don't think there is otherwise any argument that an interpreted language could be better than a compiled language (all else equal, etc.).

---
The truth basks in scrutiny.
http://i.imgur.com/GMouTGs.jpg http://projecteuler.net/profile/Sahuagin.png
... Copied to Clipboard!
Yellow
04/27/22 12:42:34 AM
#18:


You made me do some research and now I am realizing that Java is just as fast as C# in most tests and sometimes faster, even on x86, C#'s territory. So I literally take it all back, Java is alright.

It's even comparable to C++ in terms of speed.

https://www.youtube.com/watch?v=sJC3JsvhM9o

It's because Java uses JIT as well instead of plain interpretation. So yeah, it wouldn't be a bad choice for a server.

---
why am I even here
... Copied to Clipboard!
Yellow
04/27/22 12:43:51 AM
#19:


Hmm, now I have to wonder what explains the popularity of Python, something that still confuses me. I'm probably going to learn Java now.

---
why am I even here
... Copied to Clipboard!
Yellow
04/27/22 12:59:22 AM
#20:


Java also has a vastly superior open source community. Yeah I think I'll be trying out Java as my goto language.

Or maybe golang, idk.

---
why am I even here
... Copied to Clipboard!
Dikitain
04/27/22 4:00:21 AM
#21:


Yellow posted...
Hmm, now I have to wonder what explains the popularity of Python, something that still confuses me. I'm probably going to learn Java now.

I would actually try out one of the other JVM languages. Scala is my main one, and you can make some blazing fast stuff in Scala and it removes a lot of the syntactical overhead that Java has (such as using case classes which automatically generate equals, hash code, getters, and setters). Granted, it is a functional language which can take some getting used to, but if you like Golang, you will probably like Scala. It also is the basis of Spark, which is the main tool used in big data processing if you are into that stuff.

Python has its uses, it is a very good introductory language as it enforces proper code formatting. At my job, we primarily build our test suites in it. Plus, like I said it is a scripting language, so you use it for things that you would normally use perl or bash for. I wouldn't dream of using it in production code though.

---
After 16 years, I have decided my signature will NOT be about my job! But I still don't know what to put here so...yea...
... Copied to Clipboard!
11110111011
04/27/22 6:16:25 AM
#22:


Yellow posted...
Honestly, C is an ancient language and it would be a waste of time to learn these days.

C++ made it obsolete, and that's an ancient language. Programming languages age like cheese, not wine.

While this may be true in the PC / IT world, it is certainly not the case in any electrical field (automation & embedded systems). C is the most popular (in many cases only) 'programming' language apart from ladder logic.
... Copied to Clipboard!
Sahuagin
04/27/22 10:41:14 AM
#23:


Java is kind of like feature-poor C#. It can feel clumsy to use compared to C#. from what I've used I would suggest it as one of the best learning languages. (not trying to say it's better or worse here; it being "feature-poor" just means you have to do certain things by hand, and it can be a lot more verbose.)

the worst part I think compared to C# is the weak generics (and also the clumsy functional stuff). You can't have primitive generics, and generic types are lost at compile time. So where in C# you can have a List<int>, in Java you must have instead an ArrayList<Integer> (where Integer is a boxed int). (I have to go to work or might elaborate more).

Yellow posted...
C# has Blazor though, which is wonderful, everything I want out of a GUI. @Sahuagin have you seen MAUI, or Blazor yet? MAUI takes Blazor and makes it cross-platform. I love it so much.
I keep hearing about Blazor. it sounds good but I guess I'm a bit skeptical of MS web technologies, especially things that force users to use other MS web technologies...

so far for web design I can do pretty good things with TypeScript and AJAX. (with ASP.NET Core server side). some things I want to learn are Angular, React, Ruby/Rails, and node.js. I'm not sure I need any of them but I should at least understand them and why I'd use them. at the moment they seem like they basically just complicate the same things I'm already doing (Angular/React specifically).

---
The truth basks in scrutiny.
http://i.imgur.com/GMouTGs.jpg http://projecteuler.net/profile/Sahuagin.png
... Copied to Clipboard!
Topic List
Page List: 1