July 20–24, 2015
Portland, OR

Handle your design conundrums with modern Python design patterns

Anna Ravenscroft (Self), Alex Martelli (Google)
1:40pm–2:20pm Thursday, 07/23/2015
Foundations Portland 252
Average rating: **...
(2.67, 9 ratings)
Slides:   1-PDF 

Prerequisite Knowledge

Python

Description

As Python grows, the problem spaces we address keep shifting, and best practices for software development mature, so does the set of best-of-breed patterns and idioms change: some classics fading, new stars emerging.

Python itself has grown to encompass some classic idioms, such as Decorate-Sort-Undecorate, AKA DSU, begetting the widespread key= argument to most functions related to ordering — but not quite all of them: `heapq`, for example, still mostly lacks `key=` — so, we also show what idioms to use with this and similar modules.

Lists have long been one of Python’s strengths, and they’re of course still precious — but many kinds of specialized containers have emerged, and it’s important to know how to choose among them, and when and how to roll your own. More important still, iterators have grown into prominence, and very often they’ll be the best choice — and they come with a large set of relevant patterns and idioms.

The tectonic shift that’s taking us from classic to modern Python goes even deeper — even the dominance of good old duck typing is threatened! Specifically, in many cases, we use, instead, goose typing — checking against an abstract base class — and, as type annotations slowly emerge, they reinforce this general tendency.

These, and a miscellanea of smaller patterns and idioms (concerning I/O, best uses of *dict*s and other specialized mappings, async operations, testing, …), are fast becoming indispensable parts of the Proficient Pythonista’s repertoire. This talk helps fill the gap between yesterday’s good old Python, and tomorrow’s glittering vistas.

Photo of Anna Ravenscroft

Anna Ravenscroft

Self

Anna Martelli Ravenscroft has a background in training and mentoring. Her focus is on practical, real-world problem solving and the benefits of diversity and accessibility. Anna graduated in 2010 from Stanford University with a degree in cognitive science. She is a member of the Python Software Foundation, a program committee member for several open source conferences, winner of the 2013 Frank Willison Award, and co-edited the Python Cookbook 2nd edition. She has spoken at PyCon, EuroPython, OSCON, and several regional Python conferences.

Photo of Alex Martelli

Alex Martelli

Google

Alex Martelli wrote Python in a Nutshell and co-edited the first two editions of the Python Cookbook. He’s a PSF fellow, and won the 2002 Activators’ Choice Award and the 2006 Frank Willison Award for contributions to the Python community. He works as senior staff engineer for Google. You can read some PDFs and watch some videos of his past presentations.