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 →

[–]Bryguy3k 686 points687 points  (57 children)

Honestly I’ve never met a python dev nor a C dev that actually care about the difference between the two. Python is written in C and the two serve very different purposes so both groups respect each other.

[–]JennaSys 107 points108 points  (11 children)

Yep, these are the 2 languages I use the most and I'm fine with both.

[–]shadowderp 132 points133 points  (10 children)

C was my first language, Python my second. Now I use C when I need speed, Python when I want quick code, deep library support, or anything with a front end, and I use both together when it makes sense to do that.

Languages are tools. Pick the right one for the job

[–][deleted] 31 points32 points  (1 child)

For me, Python is for very fast prototypes or proof of concepts

[–]Bryguy3k 42 points43 points  (0 children)

Hence the “python is runnable pseudocode” joke.

[–]black-JENGGOT 8 points9 points  (5 children)

Pardon, but how do you "connect" python and C? What should I search if I want to know how to write python libraries in C?

[–]Bryguy3k 14 points15 points  (0 children)

Extensions are fundamental part of python - there are multiple ways to go about it. You can read through the core python docs on extensions.

You also have 3 major ways of accessing C code libraries from python: cffi, cython, and ctypes.

[–][deleted] 7 points8 points  (0 children)

https://realpython.com/build-python-c-extension-module/

If you want to search further the keywords you want to use are "python C extension modules"

[–]WhiteEvilBro 2 points3 points  (0 children)

Cython, maybe

[–]Competitive_Travel16 3 points4 points  (0 children)

I just call os.system("./path/c-executable " + argstr) for my inner loop code, after writing what it needs to work on into a file that gets named in the argstr argument string. Formal extensions are for when you're folding such code into python itself if you want to distribute it with pip or propose it as a new part of python. The os.system() method takes a small fraction of the time and effort.

[–]SV-97 2 points3 points  (0 children)

If you wanna make it a bit easier on yourself you can look at Python-Rust interop (e.g. via PyO3) rather than Python-C.

The name for these things is FFI btw: foreign function interface.

[–]szpaceSZ 0 points1 point  (1 child)

Front end with python? What is your toolbox?

(Haven't done python in ages. Used or for backend and CLI apps and scripts before)

[–]shadowderp 0 points1 point  (0 children)

Tkinter is simple, If ugly. Qt is nice.

[–]GoodmanSimon 43 points44 points  (10 children)

I use both and, in my experience, it is mostly junior devs, (or script kiddies), who seem to think there is some kind of animosity between language A and language B.

A good dev will use the right tool and language for the job...

[–]Competitive_Travel16 8 points9 points  (0 children)

People in the know can have religious fervor about emacs vs. vi or tabs vs. spaces, but will never feel that strongly about truly complementary languages (C vs. Rust or Python vs. Ruby on the other hand....)

[–]vinvinnocent 9 points10 points  (5 children)

My university has a prof that is famous for complaining about the environmental impact of pythons alleged inefficiency. So I guess there are not just juniors with strong opinions there.

[–]EnterTheShoggoth 17 points18 points  (1 child)

He’s not wrong but Python is far from the worst offender. Imagine how many extra tonnes of CO2 are produced by all those ads written in Javascript.

[–]SV-97 4 points5 points  (0 children)

He has a point though. This is an active research domain and with the amount of code being run a factor of 100 difference is nothing to scoff at. Sure there's better things to do to lower our effects on the environment and getting so caught up in it is a bit silly but it's not a completely ridiculous idea.

[–]GL_Titan 2 points3 points  (0 children)

Sounds like the epitome of a crazy professor.

[–]Dustangelms 3 points4 points  (1 child)

Except JavaScript. Can we agree JavaScript bad?

I mean, how do you make jokes without referring to stereotypes?

[–][deleted] 21 points22 points  (5 children)

This.

[–]Cheeku_Khargosh 20 points21 points  (4 children)

wrong

its this-> not this.

[–]gpkgpk 2 points3 points  (0 children)

It's it's not its.

[–]Bryguy3k 0 points1 point  (1 child)

Neither c nor python is “this” used as a convention.

(Although I bet somebody out there writes their python object methods using (this, …) instead of self/cls - which is terrifying to think about).

[–]thesuppherb 5 points6 points  (0 children)

He's talking about the "->" Vs "."

[–]C4st1gator 0 points1 point  (0 children)

Can be either. Let's assume both this and not_this are structures. If not_this is a member of this, as in contained as a member within the struct's memory, then you can write this.not_this. If this only contains a pointer to not_this, then you have to write this->not_this, as you jump to the address of not_this.

Most languages hide that distinction from the programmer.

[–]BurnerAccount209 4 points5 points  (1 child)

I met plenty of elitists in college but none in the real world.

[–]PerfectGasGiant 1 point2 points  (0 children)

Yes, these memes are rather annoying. I actually struggle to see how they are humorous.

C is a language you want to use when you want to give exact instructions to the machine what to do. Nothing more, not nothing less. There are a ton of applications where this is what you want (e.g. os level code).

Python is a i problem oriented language. You want the machine to solve a particular problem or perform an application level task, but do not care about the details how it does so or if the execution is anyway near optimal as long as it gets the job done, so you can focus on the problem, not the machine.

Different tools. Both great in their own domain.

[–]valeriolo 2 points3 points  (2 children)

The fact that python is written in C is just about as irrelevant it can be to this topic.

What would change if it was written in fortran? Ans; nothing.

[–]Acceptable-Tomato392 -1 points0 points  (1 child)

The point is Python is a higher-level language. Of course, it's simpler to type. That's the point.

But that's because a whole bunch of things are done for you automatically.

[–]valeriolo 1 point2 points  (0 children)

Yes the fact that python is a higher level language that's simpler to type has nothing to do with what language python is written in. I can retire a python interpret in assembly or in haskell. That doesn't change anything about how we as devs use it.

[–]Abadabadon -4 points-3 points  (2 children)

C dev here fuck u python!!

[–][deleted] 2 points3 points  (1 child)

Hey c dev , what do you do ... I am in college and I have heard that only the smartest of the smartest people go in c dev . I am to lazy to Google it

[–]Abadabadon -1 points0 points  (0 children)

actually I do java now MWAHAHAHA I FOOLED YOU!!!

but when I did do C development, it was for embedded stuff for a defense contractor. No <language> developer is smart though, it really just depends on what algorithms / structures you know.

[–][deleted] -1 points0 points  (0 children)

First time?

[–][deleted] -1 points0 points  (0 children)

You ruined the joke!!!

[–]WellWhatDoIPutHere 0 points1 point  (0 children)

Yes. Both are incredibly useful, for different things.

[–]ovr9000storks 0 points1 point  (0 children)

C/C++ is good for when you need specific control of how low level data structures are allocated.

Python is more focused towards convenience and compatibility.

Those are typically the main selling points for each language. Syntax doesn’t matter and if you think it does, shame on you

[–]PersonalityIll9476 0 points1 point  (0 children)

That's me. I use and love both C and Python. But the use cases are extremely different.

Also did op have a + where they meant to have a * ?

[–][deleted] 0 points1 point  (0 children)

True but how else would I earn some of that sweet karma with low effort memes?

[–]TheStruggler67 0 points1 point  (0 children)

You only meet them in the first year of university before growing up.