Contribute Media
A thank you to everyone who makes this possible: Read More

Building Protocol Libraries The Right Way

Description

One of the great strengths of Python is the incredible richness of its libraries. The standard library is already fairly good, and when you take into account the third-party ecosystem, Python’s is up there with the best in the world. Despite that, however, a great deal of effort has been wasted to get to this place. Consider Python’s HTTP ecosystem, which has many fantastic libraries. Unfortunately, there’s a stunning lack of code re-use across them: different HTTP libraries often have essentially no common code at all, despite doing extremely similar jobs. Sometimes this occurs in projects that are intended to be almost identical, such as requests and treq.

This talk proposes that the primary reason this occurs is because each library contains its own I/O layer. It explores exactly how this problem comes about, and discusses an alternative approach to library design that vastly has many benefits over the standard approach. It uses as its core examples many projects the author has worked on, including the only library he has written that he believes gets this right. It also talks about where this approach is used outside of Python to great effect to provide extra weight for the example.

Details

Improve this page