Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Modules most worthwhile reading

Tags:

python

I have been programming Python for a while and I have a very good understanding of its features, but I would like to improve my coding style. I think reading the source code of the Python Modules would be a good idea. Can anyone recommend any ones in particular?

Related Threads:

  • Beginner looking for beautiful and instructional Python code: This thread actually inspired this question
like image 466
Casebash Avatar asked Sep 29 '09 01:09

Casebash


1 Answers

Queue.py shows you how to make a class thread-safe, and the proper use of the Template Method design pattern.

sched.py is a great example of the Dependency Injection pattern.

heapq.py is a really well-crafted implementation of the Heap data structure.

If I had to pick my three favorite modules in the Python standard library, this triplet would probably be my choice. (It doesn't hurt that they're all so very useful... but I'm picking in terms of quality of code, comments and design, first and foremost).

like image 132
Alex Martelli Avatar answered Oct 13 '22 11:10

Alex Martelli