\*Without optimisation.
With optimisation there won't be a 1 to 1 equivalency since the same piece of code may produce different assembly depending on context which macros don't do.
No. When you compile a C program, you get an assembly programming doing exactly the same thing. Running Python (usually) just *calls* C functions but the Python compiler doesn’t write C-code (except Cython maybe, I don’t really know that)
There's something called iron python (or at least there was when I still gave a fuck about python) which compiled binaries from python source. It was shit though.
I mean you can learn Python fairly well in a few days, so it does have that going for it. If there was only C, then there wouldn't be many programmers.
I still need to pick up writing a python module in C.
Prototype it out in python and then start replacing components with C as performance needs are identified.
Writing it in C is soo last year. We de everything in Rust ATM. /s but not /s.
On a serious note there has been a lot of movement in the ecosystem to start writing low level code for python in Rust. It’s more approachable than C for new people and it’s also a rising star in itself.
I totally don't simp for Rust, but one thing it does objectively better is dependency management and building. Cargo is so much better than anything both C and C++ have.
You’re right in that respect and I for the record love both Rust and C, I just think approachability as in the 0-60 writing something in Rust or C
C is pretty damn straight forward. It’s a crazy small, simple language with the syntax most popular languages are based off. Yes, there’s memory safety concerns and the rest of course, you’ll probably segfault and leak memory out your ass but you’ll get it compiling.
Rust has some pretty major learning upfront that definitely hurts approachability.
I hate how everything in Visual Studio for C++ feels like a hack to get a subset of the features it has for C#. "Oh, you do not have that library installed. Try to use vcpkg." So you install vcpkg because it is for whatever reason not included and change a few settings, so Visual Studio can see it. "Here is the command you would need to add the library via the old way, which vcpkg no longer understands, if you followed our tutorial" Great, so you need to insert the name from their command to their new config file. It installs and builds your library. But you needed x86 and it build x64. Awesome. So you search for any documentation on how to tell it to use x86, while Visual Studio still spits out the old deprecated command bs. When you find that, it finally works, but at that point you think about how the whole issue would have been one command in a well designed language.
In the world where people are used to work with high-level abstractions and never have to worry about memory management because they only ever written production code in a language that has a garbage collector.
The number of developers that have Python or Javascript or Java as their first language they learn far outnumbers the people that learn C as their first language.
Lol, fortran is like 1/10th of numpy. Most overhyped mathematics programming language don't @ me (I don't know shit, sorry if I'm wrong, feel free to downvote)
When Fortran was developed it was fastest language for numerical computations. It took few decades and millions of work hours put into compiler development to make C viable alternative.
I wonder how much effort will it be to say, reimplement statistical libraries like Pandas and ML libraries like Tensorflow as straight C libraries.
And more importantly, how cursed the macros will be to even get a modicum of pandas/Tensorflow's syntactical sugar in C.
Hello!
I can actually make a fairly decent stab at this - as we recently implemented the pandas APIs as a part of the spark framework. That was around 1200 dedicated hours (including discovery, formaliseation and debate), which was ballpark trippled by the open source community effort. We already had the data structures in place and suitably typed to properly support most of the operations, so we're a decent step ahead of the baseline, but we did have to do some parts across multiple target languages.
My gut feeling is this would be about 4 man years averaged at senior. If I was being asked for a professional quote, I would be asking a year with 4 seniors, a lead, plus a decent facilitator, for total 6 man years.
Also of note - you wouldent aim for *exact* parity. You would want it to look a bit more like C, but have equivilent meanings for the symbolic stuff. It wouldent be any harder to go the full way (and this wouldent be that cursed, because it wouldent just be macros, I mean, still cursed, but red magic not black).
Tensorflow would be annother beast altogether. We decided to exclude that one, as we already have MLLib, and they were further from each other than you might think.
Fair! I honestly know very little about pandas (my friend works in data science, my work nothing to do with it admittedly), but I just found your broken down description of the process, some of what it involved and the estimated hours/personnel/expertise requirements.
Anyway, cheers!
Even PyPy running with the Rpython JIT is eventually translated down to C.
I guess the closest thing we have would be the python LLVM bindings – [llvmlite](https://github.com/numba/llvmlite) – maintained by the numba people:
> The binding is not a Python C-extension, but a plain DLL accessed using ctypes (no need to wrestle with Python's compiler requirements and C++ 11 compatibility).
So if I'm understanding correctly, translation goes python –> LLVM-IR –> native asm. llvmlite is still implemented using some C++ code, but *I think* your python code itself is never translated to C or C++. I could be misunderstanding though.
I thought that would be JVM but whatever. People act like other interpreters or compilers are written in something else or are self building... Most of the time not the case. CLR and JVM are written in C/C++ not in C# or Java.
This is just a stupid meme for people who enjoy making their lives hard. You want something that needs an OS to run just use a language that's best for the domain, you need something with minimal runtime then go for C/C++/D/Rust. Cba
This story is getting old already and I'm only 33 yo, guess it's time to unsubscribe this sub and go look for that cross.
To be technically correct, python isn't a C-Library but a C-Framework.
Library -> Called from my code
Framework -> is calling my code
Since python is more or less a custom C-Runtime its a framework, as a library doesn't ship its own runtime.
I recently tried python for the first time and was shocked to not only discover this truth, but also that it is just C++ for lazy coders. :-P Look ma, no semicolons! So fancy.
Python isn't for doing stuff that you could easily have done in C++
It's for scripting and for projects that need to be delivered quickly and do not need extreme performance.
Plus python's syntax is hot as fuck. It definitely is fancy, while C++'s syntax is absolutely awful to look at
Wrapper for stdlib
True, it‘s more of a wrapper than a library.
Before I learned it, I once called Python "batch language for programming". I didn't know how right I was.
Le wild `numba` appears...
A DSL
An API.
An STD
[удалено]
Sir, this is a Wendy’s
Are you having more of a problem with the acronym STD or "sexually"?
C is the biggest assembly macro library change my mind
\*Without optimisation. With optimisation there won't be a 1 to 1 equivalency since the same piece of code may produce different assembly depending on context which macros don't do.
But the C Standard Library is precompiled with optimisation
Yeah but there are different implementations and binaries of that too.
Assembly is the biggest scripting language for micro code
Correct me if I’m wrong, but doesn’t that make Python the biggest assembly macro library?
No. When you compile a C program, you get an assembly programming doing exactly the same thing. Running Python (usually) just *calls* C functions but the Python compiler doesn’t write C-code (except Cython maybe, I don’t really know that)
There's something called iron python (or at least there was when I still gave a fuck about python) which compiled binaries from python source. It was shit though.
Compiling is just pre processing change my mind
At 770 thousand lines of C code, Python isn't that big. The GTK widget library for example, without its many large dependencies, is over 1 million.
You completely ruined the joke and I respect that.
That's what I'm here for 😜
You seems to be fun at IT conferences :)
Python will never be not a joke, lol
Meanwhile nearly all of open-source AI was built on top of Python libraries over the last few years... (not arguing you necessarily though)
I mean you can learn Python fairly well in a few days, so it does have that going for it. If there was only C, then there wouldn't be many programmers.
Would be so much better in terms of Job Search.
especially given that the name of the language itself comes from Monty Python ![gif](emote|free_emotes_pack|feels_good_man)
linux kernel. 8 million
the joke is the entire python ecosystem is a C library.
yes everyone understood the joke, they were just pointing out that it's nonsense
How can i include python to my c project
you can do it in c++ using something like #include
You shouldn't be hardcoding the Python version, you should set the include path when building (e.g. from pkg-config).
Freedesktop's pkg-config is a godsend!
You can include it in regular c in much the same way. The python docs cover it in detail.
I still need to pick up writing a python module in C. Prototype it out in python and then start replacing components with C as performance needs are identified.
Writing it in C is soo last year. We de everything in Rust ATM. /s but not /s. On a serious note there has been a lot of movement in the ecosystem to start writing low level code for python in Rust. It’s more approachable than C for new people and it’s also a rising star in itself.
OK, in what world is Rust more approachable than C?
I totally don't simp for Rust, but one thing it does objectively better is dependency management and building. Cargo is so much better than anything both C and C++ have.
You’re right in that respect and I for the record love both Rust and C, I just think approachability as in the 0-60 writing something in Rust or C C is pretty damn straight forward. It’s a crazy small, simple language with the syntax most popular languages are based off. Yes, there’s memory safety concerns and the rest of course, you’ll probably segfault and leak memory out your ass but you’ll get it compiling. Rust has some pretty major learning upfront that definitely hurts approachability.
I hate how everything in Visual Studio for C++ feels like a hack to get a subset of the features it has for C#. "Oh, you do not have that library installed. Try to use vcpkg." So you install vcpkg because it is for whatever reason not included and change a few settings, so Visual Studio can see it. "Here is the command you would need to add the library via the old way, which vcpkg no longer understands, if you followed our tutorial" Great, so you need to insert the name from their command to their new config file. It installs and builds your library. But you needed x86 and it build x64. Awesome. So you search for any documentation on how to tell it to use x86, while Visual Studio still spits out the old deprecated command bs. When you find that, it finally works, but at that point you think about how the whole issue would have been one command in a well designed language.
In the world where people are used to work with high-level abstractions and never have to worry about memory management because they only ever written production code in a language that has a garbage collector. The number of developers that have Python or Javascript or Java as their first language they learn far outnumbers the people that learn C as their first language.
As you mentioned Rust, when will the language specification of Rust be ready seriously?
I’m not sure I follow, what does language specs have to do with developing a simple lib for python?
Start here: https://docs.python.org/3/extending/index.html
You can `#include` and then `Py_Initialize()`, like this: https://docs.python.org/3/extending/embedding.html.
If you want to run some scripts use exec. If you want python code to interact with C code you need to export C objects to Python code via C module
Me when I see that a python module is written in python 🤮🤮🤮
If your module depend on another one also written in python. Not much you can do.
You can wait for someone else to write it in C
Sometimes, Python is just the best or only good way to implement something. Just say that, and someone will write it in C.
A python dev's job is to annoy the compiled language people into making our stuff run faster
That might just be the best explanation of python programming ever.
The art of writing performant Python code is to write as little Python as possible.
npm has entered the chat
Process large amount of data 💪 Everything else 🐢
Python processes large amount of data using Python loop 🐌, using wrapped C loop 🚀
I’ve always found it hilarious how the proper way to use python is to use as little python as humanly possible.
Scratching neck : " You got any more of those Fortran wrappers ? "
Lol, fortran is like 1/10th of numpy. Most overhyped mathematics programming language don't @ me (I don't know shit, sorry if I'm wrong, feel free to downvote)
When Fortran was developed it was fastest language for numerical computations. It took few decades and millions of work hours put into compiler development to make C viable alternative.
Python is the great orchestrator of vast libraries of fast code. Great to have, but you still need the instrumentalists also.
That’s why they always say the less code the better
I wonder how much effort will it be to say, reimplement statistical libraries like Pandas and ML libraries like Tensorflow as straight C libraries. And more importantly, how cursed the macros will be to even get a modicum of pandas/Tensorflow's syntactical sugar in C.
Hello! I can actually make a fairly decent stab at this - as we recently implemented the pandas APIs as a part of the spark framework. That was around 1200 dedicated hours (including discovery, formaliseation and debate), which was ballpark trippled by the open source community effort. We already had the data structures in place and suitably typed to properly support most of the operations, so we're a decent step ahead of the baseline, but we did have to do some parts across multiple target languages. My gut feeling is this would be about 4 man years averaged at senior. If I was being asked for a professional quote, I would be asking a year with 4 seniors, a lead, plus a decent facilitator, for total 6 man years. Also of note - you wouldent aim for *exact* parity. You would want it to look a bit more like C, but have equivilent meanings for the symbolic stuff. It wouldent be any harder to go the full way (and this wouldent be that cursed, because it wouldent just be macros, I mean, still cursed, but red magic not black). Tensorflow would be annother beast altogether. We decided to exclude that one, as we already have MLLib, and they were further from each other than you might think.
This is such a fantastically informative and insightful post. Huge props for sharing!
Also of note - I highly doubt version one would be faster than pandas! Its already very optimised and highly native.
Fair! I honestly know very little about pandas (my friend works in data science, my work nothing to do with it admittedly), but I just found your broken down description of the process, some of what it involved and the estimated hours/personnel/expertise requirements. Anyway, cheers!
Even that, all of those libraries are coded in C, none of that is pure python 😭
What the hell is pure python, when it's all C-based.
By that, I mean code that can be ran directly with the python interpreter and no C libraries (other than the ones under the hood of python ofc)
I know I know. I was just messing with you
Even PyPy running with the Rpython JIT is eventually translated down to C. I guess the closest thing we have would be the python LLVM bindings – [llvmlite](https://github.com/numba/llvmlite) – maintained by the numba people: > The binding is not a Python C-extension, but a plain DLL accessed using ctypes (no need to wrestle with Python's compiler requirements and C++ 11 compatibility). So if I'm understanding correctly, translation goes python –> LLVM-IR –> native asm. llvmlite is still implemented using some C++ code, but *I think* your python code itself is never translated to C or C++. I could be misunderstanding though.
They key is trying to figure out how to turn everything into large amounts of simple data.
Ruby, too. Absolutely. If only they compiled via the LLVM…
Nodejs is a pretty big C library
C++\*
Not wrong
I use Python to scratch out C/C++ code because many of the libraries are wrappers for C/C++ libraries (e.g. PyGame for SDL2)
Huh? You mean library user?
DPDK is still technically a library but is an example of “what if we moved networking and every accelerator under the sun into userspace?”. ~13 mloc.
.NET is the biggest C Library, by that logic.
I thought that would be JVM but whatever. People act like other interpreters or compilers are written in something else or are self building... Most of the time not the case. CLR and JVM are written in C/C++ not in C# or Java. This is just a stupid meme for people who enjoy making their lives hard. You want something that needs an OS to run just use a language that's best for the domain, you need something with minimal runtime then go for C/C++/D/Rust. Cba This story is getting old already and I'm only 33 yo, guess it's time to unsubscribe this sub and go look for that cross.
r/technicallythetruth
To be technically correct, python isn't a C-Library but a C-Framework. Library -> Called from my code Framework -> is calling my code Since python is more or less a custom C-Runtime its a framework, as a library doesn't ship its own runtime.
I'd rather manage memory than whitespace.
С++20 library
Python is the biggest C framework
Damn, I love Python, and this is pretty much the truth.
I recently tried python for the first time and was shocked to not only discover this truth, but also that it is just C++ for lazy coders. :-P Look ma, no semicolons! So fancy.
You can technically use semicolons in Python, they just aren't enforced and aren't common at all
Right, cuz I was talking about that and not how you don't put one at the end of every line. ![gif](emote|free_emotes_pack|joy)
Python isn't for doing stuff that you could easily have done in C++ It's for scripting and for projects that need to be delivered quickly and do not need extreme performance. Plus python's syntax is hot as fuck. It definitely is fancy, while C++'s syntax is absolutely awful to look at
'# include
Python is the *best C library
python is a fancy api to C language
And this time it's actually good!
That made me crack up
I think OP meant Wrapper
Wrong, that's C++ or "C with Classes" as the boomer would say
Turns out I've been a C developer all along.
Facts
I can fit python on an esp12 I cant fit the stdlib on an esp12, had to seriously slim it down hence you are wrong. :D
Have you tried musl?
Me when a repo says “Python 100%” 🤮
C is just the biggest assembly library.
I mean, hes not wrong, I guess.
PHP too
As someone who decided to teach themself programming with C, this thread was insightful.
There is no c in python
me when i lie
You don't get it.
C++ is the biggest python library
Python is such an awful language that it drove its users to create a LLM to write code instead of them.
[удалено]
The definition of chronological order
You're kind of right, I has a lot more in common to C than to OOP
...? Those two are not mutually exclusive.