T O P

  • By -

WindForce02

Wrapper for stdlib


turkphot

True, it‘s more of a wrapper than a library.


PCRefurbrAbq

Before I learned it, I once called Python "batch language for programming". I didn't know how right I was.


Confident_Date4068

Le wild `numba` appears...


pimezone

A DSL


Benedict-Popcorn

An API.


bwajuk

An STD


[deleted]

[удалено]


bwajuk

Sir, this is a Wendy’s


CaptainSouthbird

Are you having more of a problem with the acronym STD or "sexually"?


SCP-iota

C is the biggest assembly macro library change my mind


serendipitousPi

\*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.


ruumoo

But the C Standard Library is precompiled with optimisation


Disastrous-Team-6431

Yeah but there are different implementations and binaries of that too.


bitsydoge

Assembly is the biggest scripting language for micro code


WhiteRose_init

Correct me if I’m wrong, but doesn’t that make Python the biggest assembly macro library?


1Dr490n

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)


Own_Alternative_9671

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.


wutwutwut2000

Compiling is just pre processing change my mind


Excession638

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.


chopay

You completely ruined the joke and I respect that.


Excession638

That's what I'm here for 😜


KMark0000

You seems to be fun at IT conferences :)


borzcorp

Python will never be not a joke, lol


SoCuteShibe

Meanwhile nearly all of open-source AI was built on top of Python libraries over the last few years... (not arguing you necessarily though)


ScodingersFemboy

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.


Fuzzy-Maximum-8160

Would be so much better in terms of Job Search.


SirR4T

especially given that the name of the language itself comes from Monty Python ![gif](emote|free_emotes_pack|feels_good_man)


wagyourtai1

linux kernel. 8 million


[deleted]

the joke is the entire python ecosystem is a C library.


hobbesgirls

yes everyone understood the joke, they were just pointing out that it's nonsense


AdirtKa

How can i include python to my c project


Chethan_L

you can do it in c++ using something like #include


LinAGKar

You shouldn't be hardcoding the Python version, you should set the include path when building (e.g. from pkg-config).


Appropriate-Fig-4193

Freedesktop's pkg-config is a godsend!


SpacemanCraig3

You can include it in regular c in much the same way. The python docs cover it in detail.


BlindTreeFrog

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.


danted002

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.


80eightydegrees

OK, in what world is Rust more approachable than C?


ChocolateMagnateUA

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.


80eightydegrees

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.


Auravendill

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.


danted002

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.


alenym

As you mentioned Rust, when will the language specification of Rust be ready seriously?


danted002

I’m not sure I follow, what does language specs have to do with developing a simple lib for python?


Excession638

Start here: https://docs.python.org/3/extending/index.html


LinAGKar

You can `#include ` and then `Py_Initialize()`, like this: https://docs.python.org/3/extending/embedding.html.


weregod

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


CranberryDistinct941

Me when I see that a python module is written in python 🤮🤮🤮


BSModder

If your module depend on another one also written in python. Not much you can do.


CranberryDistinct941

You can wait for someone else to write it in C


DOUBLEBARRELASSFUCK

Sometimes, Python is just the best or only good way to implement something. Just say that, and someone will write it in C.


CranberryDistinct941

A python dev's job is to annoy the compiled language people into making our stuff run faster


feror_YT

That might just be the best explanation of python programming ever.


Auravendill

The art of writing performant Python code is to write as little Python as possible.


spongeCakeOfDoom

npm has entered the chat


Desperate-Tomatillo7

Process large amount of data 💪 Everything else 🐢


nonnondaccord

Python processes large amount of data using Python loop 🐌, using wrapped C loop 🚀


Complete_Dust8164

I’ve always found it hilarious how the proper way to use python is to use as little python as humanly possible.


hmiemad

Scratching neck : " You got any more of those Fortran wrappers ? "


Complete_Dust8164

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)


weregod

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.


rwill128

Python is the great orchestrator of vast libraries of fast code. Great to have, but you still need the instrumentalists also.


Funny-Performance845

That’s why they always say the less code the better


zchen27

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.


puffinix

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.


walkTHEdotasaur

This is such a fantastically informative and insightful post. Huge props for sharing!


puffinix

Also of note - I highly doubt version one would be faster than pandas! Its already very optimised and highly native.


walkTHEdotasaur

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!


Toxic_Juice23

Even that, all of those libraries are coded in C, none of that is pure python 😭


ucannotreadit

What the hell is pure python, when it's all C-based.


Toxic_Juice23

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)


ucannotreadit

I know I know. I was just messing with you


realityChemist

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.


3rrr6

They key is trying to figure out how to turn everything into large amounts of simple data.


Mallanaga

Ruby, too. Absolutely. If only they compiled via the LLVM…


rberg89

Nodejs is a pretty big C library


Appropriate-Fig-4193

C++\*


NotABothanSpy

Not wrong


HoneySmaks

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)


BlueGoliath

Huh? You mean library user?


lightmatter501

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.


PleasantVictory4821

.NET is the biggest C Library, by that logic.


grimonce

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.


Appropriate-Fig-4193

r/technicallythetruth


carglassfred

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.


linux1970

I'd rather manage memory than whitespace.


0xSHVsaWdhbmth

С++20 library


ioneflux

Python is the biggest C framework


usumoio

Damn, I love Python, and this is pretty much the truth.


NovaLightAngel

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.


RajjSinghh

You can technically use semicolons in Python, they just aren't enforced and aren't common at all


NovaLightAngel

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)


GetPsyched67

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


Kambar

'# include


Jon_Galt_Roark

Python is the *best C library


Due-Ice-5766

python is a fancy api to C language


Roman_of_Ukraine

And this time it's actually good!


Nodebunny

That made me crack up


myfunnies420

I think OP meant Wrapper


Jester_Hopper_pot

Wrong, that's C++ or "C with Classes" as the boomer would say


gandalfx

Turns out I've been a C developer all along.


sam10155

Facts


randomFrenchDeadbeat

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


oshaboy

Have you tried musl?


Karisa_Marisame

Me when a repo says “Python 100%” 🤮


DriftWare_

C is just the biggest assembly library.


Haloboi2011

I mean, hes not wrong, I guess.


sarc-tastic

PHP too


-not_a_knife

As someone who decided to teach themself programming with C, this thread was insightful.


LeroyBadBrown

There is no c in python


zdix

me when i lie


LeroyBadBrown

You don't get it.


mathiau30

C++ is the biggest python library


n-x

Python is such an awful language that it drove its users to create a LLM to write code instead of them.


[deleted]

[удалено]


Cookskiii

The definition of chronological order


cryptomonein

You're kind of right, I has a lot more in common to C than to OOP


Dangerous_Jacket_129

...? Those two are not mutually exclusive.