You make want to take a look at Mojo: https://www.modular.com/max/mojo
It's not really there yet, but the promise is to "combine the usability of Python with the performance of C"
11–20 of 50 posts
You make want to take a look at Mojo: https://www.modular.com/max/mojo
It's not really there yet, but the promise is to "combine the usability of Python with the performance of C"
Write your code in C++, then make a python wrapper for it. Done.
> I want to gain a similar understanding of what is "fast" in C++ (std::move, copy elison, etc.), but with python.
But why why why why?!
The reason C++ is fast is because it gives you control! The reason Python is usable because it is very opinionated on how it gives you control.
People say "do not fight the framework." This also applies to programming languages.
Next thing you know and people want best practices for modular OOP-design in brainfuck. Now I wonder if brainfuck has something like JSDoc.
> How can I improve my ability to write data structure/algo code in python? You don't need a book on Python, you need to practice solving data structures and algorithms problems. Completely disagree with the recommendation to read Fluent Python, that book has nothing to do with your goals. > understanding of what is "fast" Do you mean in terms of performance? Depending on the problem fastest is usually to use librari…
The answer if it's performance critical is probably "write it in C" but you want to be aware enough to not end up accidentally quadratic in trivial code.
Write your code in C++, then make a python wrapper for it. Done.
Take my reaction with a grain of salt. I'm very much from a "right tool for the right job" type of school, and normally I'm not this emotional but somehow this hit a nerve. I find it funny it hit a nerve. I'm happy you posted! I've learned something about myself. > I want to gain a similar understanding of what is "fast" in C++ (std::move, copy elison, etc.), but with python. But why why why why?! The reason C++ is f…
I would say, there is no such thing as fast Python code. It's not the purpose of the language. You make want to take a look at Mojo: https://www.modular.com/max/mojo It's not really there yet, but the promise is to "combine the usability of Python with the performance of C"
It's not the purpose of the language but (business) needs don't generally care about such things. Sometimes you can't rewrite in rust for a variety of reasons and then it can pay off to know what's faster rather than slower in CPython.