Live data from Hacker News

Ask HN: Best way to learn advanced Python?

news.ycombinator.com

11–20 of 32 posts

Re: Ask HN: Best way to learn advanced Python?

#11
I'm going to echo what someone else mentioned and suggest diving into the Django source. I think it's a really well done, well organized code base. They are always in need of contributors for various issues, maybe you could investigate a bug or two. Anyway, this is what was recommended to me when I wanted to "level up" my Python experience, and I think I learned a lot by doing it.

Re: Ask HN: Best way to learn advanced Python?

#12
In addition to reading about Django, since that's what you use, I'd suggest finding a small bug to fix in the core project or a still-developing project in the ecosystem. It's a pretty mature project, so there's not a ton of low hanging fruit, but with new releases (like 4.1 that just dropped), there's always a few weird edge cases to fix.

Claim the issue and ask for some help (after doing your homework), and I suspect you'll get helpful direction. That was my experience anyways.

It will likely take some time to find something that looks interesting and solvable, but that's the best way to learn IMO so it's worth the grunt work.

Re: Ask HN: Best way to learn advanced Python?

#13

The 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.

Not exactly true. 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.

unless you're arguing for checked exceptions I don't see the evidence for inconsistency. Plus when it comes to knowing when something "is False" python's far more strict than c++'s boolean conversion rules.

Re: Ask HN: Best way to learn advanced Python?

#14

There is two different things here, “advanced” Python that applies to webdev, and other areas of Python (data science, ML). Three things I would recommend: 1. 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…

OP here - thank you for replying and I think 1 & 2 are more suitable for my background and interests. Again thanks for the guidance.

Re: Ask HN: Best way to learn advanced Python?

#15
Literature if you want to get better at using the language and gain a deeper understanding of it: "Effective Python" and "Serious Python". Also have a look at the Python standard library documentation and e.g. the data model documentation, plus the release notes of recent Python versions (e.g. pattern matching). Tons of interesting material there.

Hands-on stuff: Write command-line tools and libraries that are useful for yourself or that are somehow fun. Try out some existing or 3rd party libraries.

Re: Ask HN: Best way to learn advanced Python?

#16
post #9

What 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…

OP here. Thanks for replying. Most of my Django code is dead simple - validation, business logic, crud operations. Loops, conditionals, the occasional string manipulation, dicts, sets and exception handling. Very rarely a list comp. 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 f…

Check out Fluent Python https://www.oreilly.com/library/view/fluent-python-2nd/97814...

The list of things you never use reads just like the table of contents of the book. I've only read 1st edition but I imagine the 2nd edition is more relevant now.

Re: Ask HN: Best way to learn advanced Python?

#17

The 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.

This is the best way to pick up the fundamentals of a language, but definitely not appropriate for learning deeper concepts. You can only learn what's new. If you're driving yourself, "new" can only be stumbled upon, which is extremely inefficient. It's much better to find somewhere with a consistent presentation of "new", like a book, or complex source, written by people that regularly use the "new".

Re: Ask HN: Best way to learn advanced Python?

#19
It depends on what you are interested in? If you only know Django, then learning Flask would be a good next step. You may want to take a look at the itertools and more_itertools (https://more-itertools.readthedocs.io/en/stable/) modules if you are into writing functional Python code. Also see https://docs.python.org/3/howto/functional.html
Post reply on HN