I'm learning Python. Do someone knows a resource to learn the well-known tricks for "fast" Python? A book, a website, a cheat sheet or even a MOOC or part of a MOOC?
You Should Compile Your Python and Here’s Why
31–40 of 109 posts
Re: You Should Compile Your Python and Here’s Why
#32Not to be shit-eating, but I never understood why people use python instead of Go other than for ML teams. I program mostly in Java and Go so would love a perspective.
The common use of Python is a huge issue.
Re: You Should Compile Your Python and Here’s Why
#33Re: You Should Compile Your Python and Here’s Why
#34If you just have function and class definitions, this isn't too bad, but when you start doing things like setting up caches, reading files, and testing whether or not there's a GPU at the top level, you can add several seconds to the startup and balloon your memory usage. One wrong import somewhere in your code base, and your application will craw to a standstill on launch.
Re: You Should Compile Your Python and Here’s Why
#35"Python is Slow, And That's Fine, Because It's Fast Enough" At least this is honest. No matter what the script does, no matter how fast the libraries, the Python intepreter has a slow startup time. On multiple occasions I have seen people commenting on HN argue that Python is not slow. I think for these commenters Python is "fast enough". For others, like me, it may not be "fast enough". IOW, the question is not whet…
Re: You Should Compile Your Python and Here’s Why
#36Frankly, I would find it much easier to write the naive C version than this "moderately" optimized Python version in the article although I am much more familiar with Python than with C.
Also I really dislike python optimization tricks like `output = stdout.buffer.write`.
Re: You Should Compile Your Python and Here’s Why
#37"Python is Slow, And That's Fine, Because It's Fast Enough" At least this is honest. No matter what the script does, no matter how fast the libraries, the Python intepreter has a slow startup time. On multiple occasions I have seen people commenting on HN argue that Python is not slow. I think for these commenters Python is "fast enough". For others, like me, it may not be "fast enough". IOW, the question is not whet…
Re: You Should Compile Your Python and Here’s Why
#38Not to be shit-eating, but I never understood why people use python instead of Go other than for ML teams. I program mostly in Java and Go so would love a perspective.
In terms of building a team at a company? In my experience it's been arbitrary. Manager / Lead has experience in language X, decides to hire people who also know it. Or all the other teams are already using language X. Or Manager / Lead has heard "X language is good at Y" and decides to go with that. Or there's simply 10x more engineers (and cheaper) available for language X than Y.
The times I've seen a language picked for a particular purpose:
- Perl/Python used for web apps. It's interpreted so you can just upload your source code and refresh your browser. Faster and simpler than having to compile/package it, lots of useful frameworks and modules, lots of developers.
- Erlang/OTP for telecom. Kind of on the nose, but there you are.
- C and C++ for embedded applications.
Re: You Should Compile Your Python and Here’s Why
#39Re: You Should Compile Your Python and Here’s Why
#40I'm learning Python. Do someone knows a resource to learn the well-known tricks for "fast" Python? A book, a website, a cheat sheet or even a MOOC or part of a MOOC?
This is even more relevant if you are still learning the language. Focus on learning it, and leave arcane always changing implementation details for after you know it well.