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

Patterns for Clean API Design

Description

This talk was presented at PyBay2019 - 4th annual Bay Area Regional Python conference. See pybay.com for more details about PyBay and click SHOW MORE for more information about this talk.

Description This talk will arm you with some tools to design a library that "just works", but also has obvious escape hatches to handle corner cases. It covers several patterns for cleanly organizing related and overlapping functionality in a way that satisfies both humans and static analysis tools.

Abstract What do you do when you have to choose between designing your function for one of two common use cases?

How about when the same logical operations (say, multiplication or concatenation) need to have different implementations depending on the type of the arguments they are applied to?

These kinds of questions can be vexing when trying to design a clean, well-scoped API.

This talk will cover several strategies for grouping related functionality in a way that presents a logically clean interface to both humans and static analysis tools like type checkers and document generators.

This talk covers:

Alternate constructors with @classmethod Inheritance with @staticmethod and @classmethod Dispatch by type A new convention for namespacing functions: variants

About the speaker Paul Ganssle is a software developer at Google, maintainer of python-dateutil and setuptools, Python core developer and contributor to many other open source projects. He lives in New York City and is interested in programming, languages, wearable electronics and sensors.

Expressions of opinion do not necessarily reflect the views of his employer.

Sponsor Acknowledgement This and other PyBay2019 videos are via the help of our media partner AlphaVoice (https://www.alphavoice.io/)!

#pybay #pybay2019 #python #python3 #gdb

Details

Improve this page