Are there any code examples that show a lot of the basics?

Is there any code you can study and figure out what’s going on, like when you use the Inspect tool on Google? The code could be completely for others to see and learn from.

The itertools doc has Python equivalents for the C-coded iterator classes. These will teach you how to write generator functions. Much of the rest of stdlib is coded in Python, and hopefully in decent Python following the PEP 8 guidelines. The methods are usually reasonably short and well documented. Pick a module that you might actually use or otherwise find interesting.

1 Like