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.
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.
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.
©2015, O'Reilly Media, Inc. • (800) 889-8969 or (707) 827-7019 • Monday-Friday 7:30am-5pm PT • All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. • firstname.lastname@example.org