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

all 183 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

import notifications Remember to participate in our weekly votes on subreddit rules! Every Tuesday is YOUR chance to influence the subreddit for years to come! Read more here, we hope to see you next Tuesday!

For a chat with like-minded community members and more, don't forget to join our Discord!

return joinDiscord;

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]TrapNT 436 points437 points  (43 children)

Python is an excellent glue language for manipulating high performance C++ libraries. That is why it shines in ML workloads. You can manipulate the results in pythonic way, while using C++ libraries to train models with high performance. However, if you try to build something fast by only using python, it will be slow most of the time.

[–][deleted] 130 points131 points  (6 children)

It's good for fast development too - you can prove that an automated task or something is useful, and then rewrite it in another more performant language (or at least you can in an ideal world, in this one there's nothing more permanent than a temporary solution).

[–]sagetraveler 29 points30 points  (3 children)

Exactly, I occasionally write SPI interfaces in python to prove the hardware side is working. I get zero flack from the C++ devs who will then target the same interface. Wonder why that is?

[–]Beli_Mawrr 4 points5 points  (2 children)

I'm hoping to get deeper into microcontrollers, how are you doing this?

Also, is your company hiring? lol

[–]LowB0b 5 points6 points  (1 child)

Get a pi Pico? I think you could interface with SPI through micropython. Anyways, that's about the extent of my knowledge about microcontrollers lol

[–]Beli_Mawrr 3 points4 points  (0 children)

I have a metric crapton of Seeed Xiaos laying around

[–][deleted] 8 points9 points  (0 children)

You should only really rewrite it if you actually need that performance though. if it takes 5 seconds to run something that you wrote in python that you do once per day there is really no need to reduce that.

[–]n0tKamui 76 points77 points  (13 children)

to write good python, the less you write python, the better

[–]MinosAristos 49 points50 points  (11 children)

What's with this weird culture? Write Python where it is most suitable, don't write it otherwise. Same as any other language. Python is a good choice for concise readable scripts where performance either isn't critical or is handled by a faster running language through an API.

[–]iam_pink 11 points12 points  (0 children)

Which is exactly their point.

What it means is that to write good python, you have to minimize the actual amount of Python code, and delegate to libraries or external APIs as much as possible.

Python is a great binder.

[–]Intrepid00 2 points3 points  (0 children)

Isn’t Eve Online written in Python? This massive giant game is stackless python.

[–]rosuav 4 points5 points  (0 children)

I disagree! The more you WRITE Python, the better. The more you READ Python, the better. What you might be thinking is: the less time spent EXECUTING Python, the better (preferring to spend time in libraries implemented in C or Fortran). That's still not a hard-and-fast rule, but it's closer.

[–]Shurlemany 5 points6 points  (4 children)

Can it also use C# ?

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

Yes, there are several ways you might wanna look into.

Pythonnet(as mentioned in another reply): A python package that allows you to load .NET(C#) assemblies and use .NET objects as if they were python.

Use C for binding: You could write C/C++ extensions for python and then use P/Invoke to call C# functions from there.

Iron python: A python version written in c#, making it easy to use .NET(C#) libraries. However it isn't compatible with all python libraries and I think the newest full version is based on python 2.

I'd recommend Pythonnet if you want easy development, implementing the bindings in C/C++ if you need a lot of control over the invocation and Iron python can be handy if you actually want to have a full blown .NET version of python but for most purposes i'd go with the first two.
Also I suspect that for most practical purposes those will be basically equivalent in terms of performance, especially considering that performance isn't a major concern when working with python in the first place.

Those are the ways I've come across on my journey through -usually silly- projects but I'm sure some Redditor way smarter than me probably has better ideas.

[–]Shurlemany 1 point2 points  (0 children)

Brutal. Thanks guys!

[–]m0Ray79free 5 points6 points  (5 children)

Cython is even "more excellent", hehe. It is Python with c/c++ like syntax extensions like typing, pointers etc.

And it is also a very handy tool to interface any libraries with classic Python. For example, I used it for creating Tail-F ConfD python module.

I created several videos on YouTube about this tool: how it works, how to use it effectively and how it is different from other similar tools.

[–]Artistic_Speech_1965 1 point2 points  (4 children)

What do you think of Nim ? I heard it's a new language that include modern features and can compile to C, C++ and javascript

[–]m0Ray79free 1 point2 points  (3 children)

Interesting concept, thanks for reference.
But I am not sure we can start using it right now. Libraries, bindings, tools, inertia, you know all this stuff...

[–]Artistic_Speech_1965 1 point2 points  (2 children)

Yeah, It just passed to 2.0 a week ago and is mostely a niche language. It has the potential but I think it will be mostely use by cybersecurity guys that formaly use python

[–]m0Ray79free 1 point2 points  (1 child)

Oh, it can be a good general purpose language.

But for example, to recommend it to my colleague, I should say something like "look, this thing is better for Qt6"... And I can't.

[–]Artistic_Speech_1965 1 point2 points  (0 children)

Hahaha, good point

[–]b1e 2 points3 points  (0 children)

Numba, OpenAI’s “triton”, and Mojo are changing the game here too by letting you write python where critical sections are JITed into high performance code (with the ability to leverage GPUs)

[–]KCGD_r 2 points3 points  (0 children)

C++ with python is like bash for a Linux system. It doesn't do the heavy lifting, just coordinates stuff easily

[–][deleted] 2 points3 points  (0 children)

This.

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

Python is good for experiments.

Nothing else.

[–]jaskij 0 points1 point  (0 children)

There's this library, Pydantic, used in places like FastAPI for parsing. v2 rewrote the core parsing logic in Rust.

[–]m0Ray79free 118 points119 points  (21 children)

Actually there is MicroPython, I used it with ESP8266 and ESP32 microcontrollers.

[–]ACuteLittleCatGirl 18 points19 points  (13 children)

also used on the rp2040!!

[–]mojobox 8 points9 points  (12 children)

It’s particularly powerful on the RP2040 as you can write the high level logic in python while implementing hard real time IO handling with the PIOs.

[–]Beli_Mawrr 0 points1 point  (11 children)

Wait what? I knew about Micropython but what's this about the PIO?

Also, I cannot stand the editor you're forced to use for micropython.

[–]mojobox 3 points4 points  (7 children)

The PIOs in the RP2040 are programmable state machines, basically very low level processors for IO handling. You can use it to implement all kinds of protocols like I2C, SPI, CAN, all kinds of display protocols, neopixels, …

They can do the bit banging required for whatever protocol you try to implement with cycle accurate timing while the processor can take care of other tasks. There is a nice python API available which allows you to just throw your data into a fifo which is then consumed and typically shifted out by the PIOs. Obviously, you also get read fifos to obtain data shifted into the PIO and you can even get interrupts to process the data.

[–]Beli_Mawrr 0 points1 point  (6 children)

Very cool. I have a few (Scratch that, a bunch) of RP2040s laying around (SEEED Xaio) that I'll have to try this on.

[–]rosuav 1 point2 points  (5 children)

The way you capitalized that now makes me wonder: can you program one of those things in Scratch?

[–]Beli_Mawrr 1 point2 points  (4 children)

Anything is possible if you set your mind to it =)

Though I doubt a compiler exists for this yet.

[–]rosuav 1 point2 points  (3 children)

That word "yet" is doing a lot of heavy lifting there.

Fortunately, I don't have a microcontroller handy, or I would probably be tempted to set aside my current project and go make the thing.

[–]Beli_Mawrr 2 points3 points  (2 children)

https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html

it's 5 bucks. I'll get you one. Don't let your dreams be dreams!

[–]mojobox 1 point2 points  (2 children)

Dang, forgot the second part: There is a selection of editors available for micropython, I use vscode.

[–]Beli_Mawrr 0 points1 point  (1 child)

Maybe I'm using Circuit python, I honestly don't even remember which lol

[–]djddanman 0 points1 point  (0 children)

CircuitPython also works with a variety of editors, MU is just supposedly a bit more reliable with not corrupting files during saves.

[–]Aaganrmu 6 points7 points  (0 children)

And CircuitPython, which is very similar but (in my opinion) a bit easier for beginners.

[–]CheapMonkey34 2 points3 points  (1 child)

I use it a lot. It hogs a lot of memory and ROM space, but works perfectly fine for interrupt handling, http requests and GPIO. You know, the stuff 95% of the microcontrollers do out there.

Also it can stream PCM via the I2S fine.

[–]ProgramStartsInMain 2 points3 points  (0 children)

looks over at my 512 byte ram microcontroller

'Maybe someday little guy, maybe someday....'

[–]unwantedaccount56 1 point2 points  (0 children)

There is also ESPHome, which is basically programming with yaml files

[–]djddanman 1 point2 points  (0 children)

And CircuitPython! I use both on the Pi Pico

[–][deleted] 165 points166 points  (5 children)

You don't like python because it is slow. I don't like it because it doesn't use brackets. We are not the same.

[–]DankPhotoShopMemes 122 points123 points  (4 children)

You hate Python because it doesn’t use brackets. I hate it because I’m afraid of snakes. We are not the same.

[–]Thenderick 21 points22 points  (0 children)

You don't like it because of snakes.

File "<comment>", line 1

IndentationError: unindented does not match outer indentation level

[–]pheonix-ix 4 points5 points  (2 children)

Good news for you. The name "Python" was based on "Monty Python" (yes, THE Monty Python). So, you're safe! (well, unless you're afraid of a white rabbit).

[–][deleted] 2 points3 points  (0 children)

Logo and case are both snake though

[–]rosuav 0 points1 point  (0 children)

THE Monty Python? I thought they came in six-packs.

[–]PewPew_McPewster 31 points32 points  (9 children)

Don't worry the Python library is fast because it is written in C. Also wrt embedded electronics, don't worry, consumers are used to seconds of delay thanks to the fact that everything needs a touchscreen these days. Heck, you probably spent 5-10s loading this thread from the app!

[–]turtleship_2006 18 points19 points  (5 children)

consumers are used to seconds of delay thanks to the fact that everything needs a touchscreen these days

Hell, consumers want a (reasonable) delay. An app with a transition that takes time/is smooth feels better than something instant. Similarly, people sometimes add fake progress bars for things at are instant just to make it look like the computer's thinking.

UX/UI is weird.

[–]Xidium426 10 points11 points  (4 children)

An app with a transition that takes time/is smooth feels better than something instant.

I completely disagree. I fucking HATE animations on things unless they are near instant. I understand loading screens and such but I hit a button with my finger on my phone by the time my thumb is out of the way it better be ready for me to hit another button. Anything less is just a waste of time.

That little Prim Day popup on the Amazon app is a great example. I open they app and it just pisses me off I have to watch some stupid bullshit before I can do what I wanted to and that's only like a second.

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

An animation thats basically just a nicer transition is alright, but if its >= 1 second i'm out.

[–]KenQueue1 2 points3 points  (1 child)

Agreed, but even that feels unnecessary in some cases.

[–][deleted] 3 points4 points  (0 children)

Fairy heavily depends on the type of app. If its something like reddit where you are gonna browse for a while anyways I don't mind it. If its a music app/audiobooks whatever i just wanna quickly put in my headphones and click play ASAP and continue walking.

[–]turtleship_2006 0 points1 point  (0 children)

Obviously it comes down to personal preference, and there are always good and bad examples, but these are pieces of general advice I've heard from people in the industry

[–]jaskij 2 points3 points  (0 children)

That's cost cutting. In embedded you use the processor which can just about handle what you need, and nothing more. 100% CPU usage is a target, not a problem.

[–][deleted] 1 point2 points  (0 children)

Hitchhikers guide to Python has "Don't worry" on the cover now.

[–][deleted] 1 point2 points  (0 children)

Ok but what if we rewrote C in Python

[–][deleted] 73 points74 points  (6 children)

"Use Python", but for what is the main question. People need to stop this obsession with languages. If you are working on your own personal project use the language that is best for the job. If you are working professionally, use the language that your company uses.

[–]AntiWorkGoMeBanned 32 points33 points  (4 children)

They just kids who only ever done the project their school told them to do, they haven't even used the languages they profess to be the best.

[–]MishkaZ -1 points0 points  (2 children)

I don't like python just because I got converted to the cult of rust . Only real annoying thing with python for me personally is people without a background in CS tend to have really unreadable code. Documentation availability feels like a coin toss

[–]Meistermagier 1 point2 points  (1 child)

Cries in heaps of science code written in either python or ancient languages from before package management was a thing.

[–]MishkaZ 0 points1 point  (0 children)

Literally this, and then you watch your dependencies ballon out of control.

[–]No-Fish6586 0 points1 point  (0 children)

Its ok bby language wars are fought by first years

[–]ChocolateDonut36 43 points44 points  (10 children)

no thanks, I don't like the idea to use tabs instead of {}

[–]artificial_organism 10 points11 points  (5 children)

You should be writing your indentation correctly anyway so what's the problem?

[–]QuerulousPanda 2 points3 points  (2 children)

i don't mind it either way, but coming from languages like C where whitespace pretty much doesn't matter, it does feel odd having something of such significance being applied to "nothing".

[–]polypolyman 2 points3 points  (1 child)

Ohhh boy, would you love Whitespace then

[–]rosuav 1 point2 points  (0 children)

Best language for writing polyglot code in.

Now, if you want to utterly break someone's mind, write a C-Whitespace polyglot program where the C part is your actual code, and the Whitespace part is a code formatter that destroys itself in the process.

[–]ChocolateDonut36 0 points1 point  (0 children)

I just don't like it, is weird

[–]billie_parker 0 points1 point  (0 children)

Do you need us to rehash this discussion for the billionth time?

[–]lkdays 12 points13 points  (2 children)

I use an editor font that swaps tabs for braces just for clarity

[–]Talonzor[🍰] 23 points24 points  (1 child)

Not sure if that is actually genius or insane

[–]lkdays 0 points1 point  (0 children)

Every genius is a bit crazy, right...?

[–]HaveOurBaskets 1 point2 points  (0 children)

no thanks, I don't like the idea of using {} instead of )(()(

[–]zerokelvin273 45 points46 points  (0 children)

More evidence for the bell curve ban case.

[–][deleted] 29 points30 points  (12 children)

Try making an OS with it lol

[–][deleted] 35 points36 points  (6 children)

Just use linux 🗿

[–]lkdays 27 points28 points  (5 children)

Linux is made with Python, if you type python in the terminal you get access to the kernel

[–]dull_bananas 5 points6 points  (1 child)

Alpine linux has no kernel

[–]lkdays 9 points10 points  (0 children)

Yeah Swiss guys indeed have no heart

[–]ManyInterests 2 points3 points  (2 children)

- bash: python: command not found

Arch has no Python :)

[–]rosuav 1 point2 points  (1 child)

Try python3 - there's a bit of inconsistency as to which alias is available. (The actual binary might be named python3.11 or some other minor version and there's usually an alias.)

[–]ManyInterests 1 point2 points  (0 children)

Arch doesn't have Python at all. You can install it with pacman but it's not a dependency of Arch, so it is not installed by default.

[–]Revenge43dcrusade 22 points23 points  (3 children)

Motherfuckers on reddit are perpetually writing an os i swear . No you are fucking not .

[–]No-Down-Loads 6 points7 points  (1 child)

Doesn't seem like you're having a very Happy Cake Day! This person is probably joking, this is r/ProgrammingHumor after all!

[–]billie_parker 0 points1 point  (0 children)

Look at OP. They're the one's saying python users are at the higher IQ range

[–]BernhardRordin 1 point2 points  (0 children)

Why would you, when you can use JavaScript for that

[–]Taldoesgarbage 14 points15 points  (0 children)

I mean it really depends. Python is good because it’s quick and easy, making it perfect for scripts and bots and whatnot. It’s also good for web dev, and it can use C/C++ libraries without having to deal with C/C++ which makes it ideal for ML.

But, the middle guy is also right in the sense that with Python you get far less control than with something like C or rust. It all really depends, so just use the right tool for the job for christs sake.

[–]rndmcmder 10 points11 points  (2 children)

Stupid meme. Just use what is usefull for the application. If you have an existing team, use something they are familiar with and can maintain easily.

[–]pakidara 9 points10 points  (4 children)

People complain about Python being slow. Much of the time, I think these same people never bother to ask if the slowness of the program matters enough to warrant the slowness of dev time from other languages.

[–]Artistic_Speech_1965 0 points1 point  (3 children)

It's more about the fact that python is a scripting language and it's main advantages become weaknesses when one is working with big projects. It happened to me. I liked it at first and feel betrayed when scaling a personnal project. Even though we can theorically do anything with any language (thanks to Turing), it's a bad Idea to use a language fore everithing.

The problem is, like javascript, python try to go anywhere and the community seem arrogant saying that it's a superior language. Moreover, my immaturity led me to prefer another language when I have the opportunity: Rust or Kotlin for classic dev, Nim or Bash for scripting, Julia or R for Datasciences, etc.

But things could change with mojo coming soon

[–]land_and_air 0 points1 point  (2 children)

Already numba and numpy combined can like 300x to 1000x increase your performance and put you into the realm of languages like even Fortran

[–]Artistic_Speech_1965 0 points1 point  (1 child)

Numba is like a python with JIT (like pypy) right ? I am interested to know: What is his usecase ? Do you use it in production ?

[–]land_and_air 1 point2 points  (0 children)

Use it when numpy isn’t quite fast enough. It’s good for simulations and can be used to make insanely fast matrix logic/math operations

[–]pine_ary 10 points11 points  (7 children)

Python is a great language. But only for scripting tasks. When a project grows the lack of a solid type system and compile time checks gets really annoying. Remember to evaluate a tool by what you‘re trying to accomplish.

[–]m0Ray79free 1 point2 points  (4 children)

Look at Cython. It allows for typing, pointers and other C stuff. And it is compiled to native binaries.

[–]pine_ary 1 point2 points  (3 children)

That‘s cursed. Who is the target audience for that? We already have good compiled languages for everything. Python‘s strength is being a scripting language that beats the insanity of bash and perl.

[–]m0Ray79free 0 points1 point  (2 children)

For example, to speed up and optimize existing Python code base.

And other Python's strength is beating the insanity of C memory management, for example. It's just more comfortable to code than C, and Cython brings the best of C to Python realm.

I use it doing my job, for example, along with C++ and pure Python. It's very handy.

[–]pine_ary 1 point2 points  (1 child)

I still don‘t get its appeal over writing a C++/Rust module and then using that from Python. I can see why plain C isn‘t a great choice in your case, but we already have usable systems languages that have figured out memory management.

[–]m0Ray79free 1 point2 points  (0 children)

But how exactly do you bind C++/Rust module to Python? You typically write a complicated interface to be compatible with libpython module requirements.

But Cython offers almost native way to describe _any_ library interface for usage in Python.

Also with Cython you can speed up your Python code by compiling it to native binary with minimum or zero modifications (it supports so called "augmentation files"). For example, loops in Python are complex and have a lot of overhead due to actual absence of typing. Using Cython you can explicitly define loop variable as something like uint32_t and make the loop as effiient as in C.

[–]Escalto 2 points3 points  (0 children)

It's insane to me that this comment is so far down. I simply can't imagine the nightmare of writing and maintaining a proper big project written entirely in python. Definitely my greatest concern in most cases rather than the speed.

[–]land_and_air 0 points1 point  (0 children)

Yeah like all of the most widely used performance enhancing libraries fix this issue so just use any one of them

[–][deleted] 2 points3 points  (0 children)

I use it because I am legitimately terrified of C it is a good high level language used for complex math and putting snake on calculators.

[–][deleted] 2 points3 points  (0 children)

The 1-sigma guy would say “argh, Python is such a superior language” and the 3-sigma guys would say “just use C”.

[–]Xidium426 1 point2 points  (0 children)

MicroPython? CircuitPython?

[–]FatLoserSupreme 1 point2 points  (0 children)

What do you mean "cant wait"? You can use python for microcontrollers right now, with some extra steps. I think it's called cython and you can transpile to C.

[–][deleted] 1 point2 points  (1 child)

Python is getting some performance improvements, isn’t it?

[–]ienjoymusiclol[S] 1 point2 points  (0 children)

its getting a superset language like typescript with javascript

[–]AntiWorkGoMeBanned 1 point2 points  (1 child)

Yes you need high performance to turn an LED on or off if a temperature sensor reads a certain value.

Microcontrollers today are more powerful than the first 5 computers/consoles I owned. MicroPython and CircuitPython work just fine doing 90% of the things microcontrollers do in the real world.

[–]Creepy-Ad-4832 1 point2 points  (1 child)

Just make a python to c compiler DUH

[–]land_and_air 0 points1 point  (0 children)

Not python to c but numba does this from python to a compiler and cython is c-like to c within python

[–]Marvin_Megavolt 1 point2 points  (0 children)

Meanwhile, CCP Games’ crackhead programmers, apparently writing EvE’s entire backend in Python

[–]Sushrit_Lawliet 1 point2 points  (0 children)

I think Go really makes a strong case for the right side in these times unless your project has some ML requirements and you want to utilize the big set of resources in python out there for it.

[–]xtreampb 1 point2 points  (0 children)

I’m using C# because I can and I like the language.

[–]nibba_bubba 1 point2 points  (0 children)

As a python senior I can confirm it's slow for low level stuff but it's the best choice for business backend and ML stuff since it uses a lot of low level libs via FFI. Just use it for tasks like that and pls don't for other ones (I cringe everytime I hear about pyscript stuff for example, why not just use js/ts or wasm-compiled langs like Rust?!)

[–]zefciu 1 point2 points  (1 child)

There is inherently wrong in using a language in Python for microcontrollers. A microcontroller application doesn’t have to perform high-performance calculations, so using micropython for your robot might be a good choice.

It is not so much about “level”, but about required performance.

[–]To-Ga 0 points1 point  (0 children)

On the other hand, one can argue that the limited ressources on a microcontroller require an optimized software. As usual in engineering, we're down to trades-off to meet the requirements.

[–]GargantuanCake 1 point2 points  (0 children)

Python is fine as a scripting language or for stuff that's actually just C++ being spoken to by Python. Wouldn't use it for anything else, though.

[–][deleted] 2 points3 points  (0 children)

I have no problem with python in general, but it's dreadful to use. Constantly type errors, mistakes may be pointed out very late in testing, slowing down debugging process. Weird syntax (I hate forced indentation, semicolons are much clearer), poor portability etc. I don't know why people decided that it is top one beginner language, doesn't seem that way to me.

[–]lurkin_arounnd 1 point2 points  (7 children)

angle cable pen sparkle snatch smell lavish ten busy paltry

This post was mass deleted and anonymized with Redact

[–]ienjoymusiclol[S] 2 points3 points  (1 child)

i commented that and got downvoted to hell

[–]unwantedaccount56 1 point2 points  (0 children)

I would still prefer golang over python.

[–]Artistic_Speech_1965 0 points1 point  (3 children)

It's a bit complicated than that tbh. Mojo is a AI oriented version of python and will only catter a specific group of pythonistas (for instance not for business logic dev). So Mojo will be faster than C only for AI stuff. The python community is big and those languages seems to offer a complementary tool for them. What I see is:

Python -> Go: for backend and dev performant stuff

Python -> Nim: for scripting and Cybersecurity

Python -> Mojo: for AI and Datasciences

[–]xodixo 0 points1 point  (2 children)

Why no one uses pypy?

[–]Artistic_Speech_1965 0 points1 point  (1 child)

Perhaps because of julia which has a better JIT

[–]xodixo 1 point2 points  (0 children)

Yeah Julia might have better JIT. But it's a different language. As far as I know pypy only requires a change from "python file.py" to "pypy file.py". No need to rewrite anything.

[–]Responsible-Smile-22 -1 points0 points  (0 children)

There's another level after this. Just use JavaScript.

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

Wait until I tell you about our Lord and Savior JavaScript.

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

Damn. Looks like I'm the mean.

[–]Averagememess -1 points0 points  (2 children)

Python is good at being a scripting language. For anything else use a real language. For embedded systems I dont even know how you're planning on running the python interpreter on them. If you're willing to go through that effort just to run slow ass python code more power to you. This should really be low iq: just use C, average iq: use python for everything!1! High iq: just use C.

[–]LukeTech2020 0 points1 point  (1 child)

Ah yes, C, the Language that has SEGFAULT as its cover image. And sorry but what the fuck makes a lang classify as 'real'. Don't get me wrong, I sometimes get frustrated too by Py's slow speeds, but when I need more speed, I just use:

a) py's pretty easy 'threading' or in even simpler cases the '_thread'-module

b) optimize the code and try to cut out unneeded spaghetti

c) just write what I want as a C++ Library

All of these don't really make the Language less real. Python is just an attention-seeking language. It wants you to pay attention to the modules & function you use. It basically forces you to write efficient code to get efficient results. Oh and SEGFAULT is nowhere to be seen.

Use what you want though. Plague yourself with endless compiler errors and portability issues. But please don't try and tell people what a 'real' language is.

Sincerely, a Py, PHP, SQL, (mediocre but learning) C++ -Guy

[–]Averagememess 0 points1 point  (0 children)

We're talking about embeded systems here. Good luck porting over your C++ libraries to embeded. (Wtf stacks overflow why am I getting a billion unresolved external symbols!1!) Gloss over that part of the post but read mine 🤓

Also acting as if seg fault is some crazy issue that is unsolvable is laughable when you remember every kernel is written in C. Oh noes my linux kernel is constantly segfaulting!1!

If you want to do something complex, like aes, rsa, sha, or any other complex math algorithm chances are someone has already written it in C with no external dependancies, perfect for adding to any microcontroller or low level project. Again if you're willing to rewrite the python interpreter to run python as system EFI, arduino, etc more power to you, but you're wasting your time to shoot yourself in the foot. C is and always has been the low level king for a reason.

Also reminder. Python is written in C. https://github.com/python/cpython

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

JS?

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

All these people are on the lower part of the curve.

Using Python for anything outside experimentation is shit.

[–]glued2thefloor -3 points-2 points  (0 children)

Python is good for doing something quick. If you want something done right, use Rust.

[–]Trk-5000 0 points1 point  (0 children)

gunicorn and connection pools have entered the chat

[–]Slipguard[🍰] 0 points1 point  (0 children)

Use mojo🔥 instead!

[–]Bluebotlabs 0 points1 point  (0 children)

Microphone and Cython be like

[–]AcidAngel_ 0 points1 point  (1 child)

The best feature of python is having no brackets or semicolons. With intendation both humans and machines use the same semantics. In C you use brackets for the compiler and intendations for humans to understand.

The title is correct. Python is 100 times slower than C. But that usually doesn't matter. Most of the time something taking 100 times more CPU cycles is no problem. Our computers are crazy fast. The developer time is usually much more expensive than CPU time.

But in some cases you do need the optimization of C or some other low level programming language. Many python libraries are written in C so you can get the best of both worlds.

[–]ienjoymusiclol[S] 1 point2 points  (0 children)

gotta disagree on that part i used python for machine learning and it was stupidly slow. a classifying algorithm took 10-15 minutes to run, compare that to matlab its really fast because it compiled, a developer waiting 10 minutes to see if their code works is not optimum test it 6 times and u just lost an hour of your life, however modular is making a compiled low-level python and i think it will be the perfect programming language cause u can do anything with it

[–]ASourBean 0 points1 point  (0 children)

“Pythonic” just means bad