3 ms·
Absolutely off-topic, but can somebody advise on the best resource to learn the most up-to-date Python for somebody who is mentally stuck on Python 2.7-3.2? I a
by krick 6y ago
Absolutely off-topic, but can somebody advise on the best resource to learn the most up-to-date Python for somebody who is mentally stuck on Python 2.7-3.2? I always referred to Python when I needed to quickly write some tool for personal use, but never professionally, even though I am a professional programmer. And recently while writing something like this I was struck with how bad my Python actually is in 2020, compared to how other languages I know currently look. Quick lookup shows that it seemingly has pretty powerful typehints system now, but I never used it. I have no idea, which parts of standard library you aren't supposed to actually use anymore, and use some well-established 3rd part library instead (like it was with requests). And stuff like that. And is it even a good idea, to finally switch to the newest versions of Python and to never look back?
So, basically, what's the best way to catch up?
- ghshephard 6y agoI"d strongly recommend Trey Hunner at PythonMorsels. The approach is to give you a concise problem that should exercise some part of your python knowledge, and have you write code, re-write your code, bang your head against a problem, and then, once you've written something that passes all the unit tests, you get a walk through possible solutions by someone who knows python well. Trey starts with a description of how you might solve the problem (which is about how I solved the problem 50% of the time) that is almost always clearly wrong, even though it "works" - then he shows you a somewhat more pythonic and modern way - and you go, "aha!", and then, he shows you the elegant solution - and it changes your life, and you use that pattern in everything you write. His focus though, is really on how to write clean pythonic 3.x code more than the latest and greatest features, but he tags his problems/solution sets, so if you really want to dive into decorators, or context managers, or dunder methods - you can zoom right in. The only problem I've had with Python Morsels is I look at the code I wrote a year ago (I'm not a developer) and I'm embarrassed and ashamed at how gross it was.
- neoncontrails 6y agoI wholeheartedly endorse The Python Cookbook by David Beazley. It's almost a decade old, but hasn't aged a bit. Its "recipes" are practical, elegant, and often somewhat cheeky: I'm thinking in particular of a puckish trick he uses to lazily interpolate variable bindings into a format string automatically by resolving it in the context of previous stack frames (helpfully packaged as a modular function that emits nice errors), and another to tamper with the restrictions of the GIL by executing threaded computations in separate interpreters. But while the book is loaded with black magic, it's also the first place I turn when trying to refresh myself on more quotidian topics like navigating a filesystem, making subprocess calls, overriding class instance behavior with magic methods, etc.
- choicenotchance 6y ago> bsolutely off-topic, but can somebody advise on the best resource to learn the most up-to-date Python for somebody who is mentally stuck on Python 2.7-3.2? I always referred to Python when I needed to quickly write some tool for personal use, but never professionally, even though I am a professional programmer. And recently while writing something like this I was struck with how bad my Python actually is in 2020, compared to how other languages I know currently look. You are me!
- rvdmei 6y agoJust build something you need (or just a simple To Do app) and use a modern library / framework that uses the “new” stuff. I can highly recommend to give FastAPI a try. Even just going through the examples in the docs (amazing docs) should get you started.
- Doxin 6y ago> So, basically, what's the best way to catch up? Install the latest python version and use it. Ignore the bits you don't need. The type hints for example are neat but entirely optional.