Python Modules most worthwhile reading

前端 未结 4 842
一向
一向 2021-01-29 23:42

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

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 00:12

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

提交回复
热议问题