Ask HN: Best way to learn advanced Python?
1–10 of 32 posts
Re: Ask HN: Best way to learn advanced Python?
#2Re: Ask HN: Best way to learn advanced Python?
#3The best way to improve is by writing more code in python. You can develop a desktop gui app or an open source python package to challenge your python skills.
You will need good examples.
Python from the start is a “higher performance” hack of a language (wrap everything you do on a try block because the language is so finicky and inconsistent failure is the most reliable way to know something is false.)
Find a good example and follow it while writing more code.
Re: Ask HN: Best way to learn advanced Python?
#4What does advanced Python mean to you?
Answers will dictate what makes sense for you. Since you said you're a Django dev, maybe try re-implementing a library/dependency you use. Start with something obvious, and then maybe something less so.
You'll learn quickly how much of it is advanced Python vs advanced Django. Python is very deep, but you don't really need to know most of it. And the ones who do, know it because they were trying to accomplish something specific.[1]
[1] Tweet about slots by author of Flask - https://mobile.twitter.com/mitsuhiko/status/5004329133817487...
Re: Ask HN: Best way to learn advanced Python?
#5Django's code leans heavily into advanced Python features like metaprogramming. To use Django, you don't need to understand it, but once you start customizing things or building on what Django provides, you need to read through Django's code to understand it. And if you don't know things like metaprogramming, you'll get lost quickly.
There's not a lot of great resources for intermediate Python developers to learn these concepts. I tried reading Fluent Python but found it difficult to follow. I then checked out Learning Python 5th Ed., which is a little dated at this point, but has some good chapters on metaprogramming at the end.
That's basically how I started to get my arms around these advanced Python features to be able to understand Django's codebase a little better.
Re: Ask HN: Best way to learn advanced Python?
#6The best way to improve is by writing more code in python. You can develop a desktop gui app or an open source python package to challenge your python skills.
it would be like practicing a sport and just making the same mistakes without changing form or strategy
Re: Ask HN: Best way to learn advanced Python?
#71. As a Django dev dig deep into Django’s internals, there is loads to learn from its codebase, particularly meta classes in the orm and form frameworks. The template engine is also highly complex. Try building a tool that scratches your own itch with Django, and integrate it deeply using some of the techniques Django uses. Read lots of its code, work out how it works.
2. I think a good project to explore other areas of Python would be a web scraping then data processing project. Find something that interest you, build a scraper that extracts LOADS of data from the web or a specific site about it. Then analyse that data using NumPy and Pandas. It will teach you a bunch of new tools.
3. If you are interested in ML there a loads of interesting academic projects that have released their code on GitHub. Find one that, again, interests you (image processing, text generation, computer vision), download it, get it running, and then modify it to do something else. Or package it as a web app or something. You will learn loads about how these tools work.
Re: Ask HN: Best way to learn advanced Python?
#8I have this same question and also work in Django, so I think I know what OP is asking about. Django's code leans heavily into advanced Python features like metaprogramming. To use Django, you don't need to understand it, but once you start customizing things or building on what Django provides, you need to read through Django's code to understand it. And if you don't know things like metaprogramming, you'll get lost…
Re: Ask HN: Best way to learn advanced Python?
#9What do you want to achieve by learning advanced Python? What does advanced Python mean to you? Answers will dictate what makes sense for you. Since you said you're a Django dev, maybe try re-implementing a library/dependency you use. Start with something obvious, and then maybe something less so. You'll learn quickly how much of it is advanced Python vs advanced Django. Python is very deep, but you don't really need…
Almost never dunder methods, writing an annotation, oop, generators, worrying about concurrency, threads, locks, etc. Things that I know the equivalent of in Java very well since I came from that world.