eGenix Talks: Python Idioms

EuroPython 2015 - Python Idioms to help you write good code

Talk given at the EuroPython 2015 conference in Bilbao, Basque Country, Spain, presenting Python idioms which are especially useful for programmers new to Python.

Python focuses a lot on writing readable code and also tries to make solutions obvious, but this doesn’t necessarily mean that you cannot write unreadable code or design your code in ways which makes it hard to extend or maintain.

This talk shows some useful idioms to apply when writing Python code, how to structure your modules and also goes into details on which techniques to use and which to think about twice, based on 20 years of experience writing Python.

-- Marc-Andre Lemburg, Senior Software Architect

Talk Video

This talk was given at the EuroPython 2015 conference in Bilbao, Basque Country, Spain, by Marc-André Lemburg, CEO of eGenix.com.

Mr. Lemburg is available as Python coach and consultant, if you need help in designing your Python applications, refactoring existing ones, or managing such projects to successful completion.

Talk Agenda

  • Coding Conventions
    • Python Coding Conventions: The Basics
    • PEP 8 – Python Coding Conventions
    • Coding Conventions: Python Module Layout
    • Module Layout: Header Section
    • Module Layout: Tools Section
    • Module Layout: Body Section
    • Module Layout: Overview
    • Module Guidelines
  • Common Patterns in Python
    • Duck Typing
    • Facade / Adapter
    • Singletons
    • Factories
    • Wrappers / Proxies
    • Callbacks
    • Code evolution pattern in Python
    • Code Evolution: From scripts to functions
    • Code Evolution: Abstracting functions to classes
    • Code Evolution: Abstracting classes into components
  • Performance Idioms
    • Looping over sequences
    • Joining strings
    • Exceptions
    • More performance hints
  • Coding Idioms
    • Deeply nested if statements in loops: Staircase Syndrom
    • Avoid mutable state in module globals
    • Function/method default parameters
    • Class default attributes
  • Avoiding Gotchas
    • Use the in operator in Python
    • Boolean testing in Python
    • Container empty testing in Python
    • Commas in Python: 1-Tuples
    • Commas in Python: Listings
  • Tools
    • Code Checking Tools

Talk Slides

The talk slides are available as PDF file:

Using the Talk Video Player

For the best viewing experience, please select 1080p HD quality by clicking on the small gear icon and then switch to full-screen mode by clicking on the rectangular bracket icon on the lower right side of the player.

(c) Copyright 2015 eGenix.com. All Rights Reserved.