this post was submitted on 27 Aug 2023
54 points (98.2% liked)

Python

6160 readers
3 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

I am at a high-beginner/low-intermediate level in Python, and one thing that drives me nuts is how poorly I am able to read the Python official documentation and grok how to use the described code.

What's the secret? Are there any guides/videos/books that can help my understand how to approach reading it? Or, is it just one of those things that I need to just keep coming back to while coding, and eventually I will get the hang of it?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 15 points 1 year ago* (last edited 1 year ago) (2 children)

I feel the same and I've been using Python for years professionally. It's the lack of examples for me; usually functions and classes aren't meant to be used as-is but rather fed as an argument into some other function or class, and this info is seldom portrayed in the func's documentation. E.g. the documentation of BaseHTTPRequestHandler is one that I trip over every single time, I have to resort to reading the source code of SimpleHTTPRequestHandler to remember how handlers are supposed to be defined 🐺

[–] [email protected] 8 points 1 year ago

Well put. I also hate that it always dives into edge cases but never explains the basics.

[–] [email protected] 3 points 1 year ago (1 children)

You just exactly put into words why I find it so challenging!

[–] [email protected] 1 points 1 year ago

I recommend getting very familiar with pythons help(), dir() and type() functions. The help function almost always includes examples for the methods you're trying to use, tells you what arguments it expects, and what arguments are passed by default. The type function can help you understand the inheritance of OOP and what type of object you're looking at, and dir on that object will tell you what attributes/methods are defined for your object type.

Other than that, find some good books. I'm a big fan of Michael Driscoll's Python 101 and 201 books.