4 ms·
Maybe also knowing when not to use python, or finding a solution in python that uses C/rust/etc underneath.
by tyingq 11mo ago
Maybe also knowing when not to use python, or finding a solution in python that uses C/rust/etc underneath.
- knowitnone3 11mo agomaybe you can skip C and just use assembly
- guhcampos 11mo agoOr fab your own chip.
- postexitus 11mo agoOr wire wrap your own transistors.
- NoteyComplexity 11mo agoOr build yourself a set of vacuum tubes from sketch, don’t forget to make the glass from sand too.
- tyingq 11mo agoIf it's a module doing cryptography, maybe...Not suggesting C or rust in places where it doesn't make sense. Python itself make choices about whether the things it ships with are pure python or not. They often are not.
- lunias 11mo agoIt's kinda funny how uv is written in Rust and many Python libraries where performance is expected to matter (NumPy, Pandas, PyTorch, re, etc.) are implemented in C. Even if you call into fast code from Python you still have to contend with the GIL which I find very limiting for anything resembling performance.
- woodruffw 11mo agoPython's strong native story has always been one of its biggest draws: people find it ironic that so much of the Python ecosystem is native code, but it plays to Python's strength (native code where performance matters, Python for developer joy/ergonomics/velocity). > Even if you call into fast code from Python you still have to contend with the GIL which I find very limiting for anything resembling performance. It depends. A lot of native extension code can run without the GIL; the normal trick is to "detach" from the GIL for critical sections and only reconnect to it once Python needs to see your work. PyO3 has a nice collection of APIs for holding/releasing the GIL and for detaching from it entirely[1]. [1]: https://docs.rs/pyo3/0.27.1/pyo3/marker/struct.Python.html#method.detach https://docs.rs/pyo3/0.27.1/pyo3/marker/struct.Python.html#m...
- SAI_Peregrinus 11mo agoPython is the ultimate (for now) glue language. I'd much rather write a Python script to glue together a CLI utility & a C library with a remote database than try to do that all in C or Rust or BASH.
- lunias 11mo agoYeah, it's great for stuff like that, but I find myself using Node more in that area.
- lunias 11mo agoI didn't know about detaching from the GIL... I'll look into that. > native code where performance matters, Python for developer joy/ergonomics/velocity Makes sense, but I guess I just feel like you can eat your cake and have it too by using another language. Maybe in the past there was a serious argument to be made about the productivity benefits of Python, but I feel like that is becoming less and less the case. People may slow down (a lot) writing Rust for the first time, but I think that writing JavaScript or Groovy or something should be just as simple, but more performant, do multi-threading out of the box, and generally not require you to use other languages to implement performance critical sections as much. The primary advantage that Python has in my eyes is: there are a lot of libraries. The reason why there are a lot of libraries written in Python? I think it's because Python is the number 1 language taught to people that aren't specifically pursuing computer science / engineering or something in a closely related field.
- fainpul 11mo agoPeople are making fun of this statement here / are being sarcastic. But it's a totally legit suggestion. If you know in advance, you are going to make something where performance matters, strongly consider using something other than one of the slowest languages of them all.