Hacker News new | ask | show | jobs
by serjester 1065 days ago
Assuming you have the fundamentals down, I’d recommend taking the time to dig in and understand the source code of a couple well written packages. Start with some simple libraries like datetime, requests, flask and move on to more complex, modern examples like pandas / fastapi.

Clone the package, run the tests, break the tests and try adding functionality. You’ll learn a lot - I know I did when I was starting out.

I’d also recommend checking out Fluent Python.

5 comments

This is great recommendation, you can get very far by reading well written code. These have very well written Python, exposing much of the language expressiveness:

- https://github.com/python-attrs/attrs

- https://github.com/mahmoud/glom

- https://github.com/pytoolz/toolz

- https://github.com/Suor/funcy

- https://github.com/dabeaz/curio

  ps: dabaez has great educational content on writing idiomatic python, definitely worth checking out
An honorable mention of norvig's classic essays, which got me into python while I was in college, over 12y ago: https://norvig.com/spell-correct.html.

Aside from reading code, _writing_ something that you know it exist (e.g glom) and then comparing it to how others have done it is also a great learning experience.

Yeah, reading the Fluent Python book[1] and / or following along with their support files[2] would a good way to start

[1] https://amzn.to/3J48u2J

[2] https://github.com/fluentpython/example-code-2e

Just fyi to cheapskates like me, i was looking around for a free pdf, some are hosted on github, others on google docs. Putting the pdf urls into https://www.virustotal.com/gui/home/url , all were suspicious or malicious. I think ill search around a bit more, but will probably give up.
Might be of some interest to you: https://annas-archive.org/
Unfortunately it seems pdfs linked there may also be malicious ( https://www.virustotal.com/gui/url/7e73cc3d685c77d88ad9cf769... ). I checked on some other pdf links ive downloaded previously and they were safe, so I don’t believe the software just flags everything.

But it could be if the coding book includes working examples and exercises, that would probably flag any system looking for code execution.

I'm inclined to say that those are false positives, given the obscurity of the vendors who are flagging the URL.
Second or third reco for Fluent Python. Also, to be a purist for a moment. Explicit is better than implicit. Use this as a razor to decide all ties in your design.
FastAPI, while a very impressive codebase, is not approachable at even an intermediate proficiency in Python.

It is _staggeringly_ dynamic, and basically uses runtime reflection of "static" types to scaffold a really complex ast describing your application.

Fluent Python is fantastic.