Python Epiphanies

Type:
Tutorial
Audience level:
Intermediate
Category:
Core Python (Language, Stdlib)
March 8th 9 a.m. – 12:20 p.m.

Description

This tutorial is for software developers who've been using Python with success for a while but are looking for a deeper understanding of the language. It demystifies a number of language features that are often misunderstood.

Abstract

In many ways Python is very similar to other programming languages. However, in a few sometimes subtle ways it is quite different, and many software developers new to Python, after their initial successes, hit a plateau and can't figure out how to get past it. Others don't hit or perceive a plateau, but still find some of Python's features a little mysterious. This tutorial will help deconstruct your incorrect assumptions about Python and pull away the mists of confusion.

If in your use of Python you sometimes feel like an outsider, like you're missing the inside jokes, or like you have most of the puzzle pieces but they don't quite fit together yet, this may be a good tutorial for you.

After completing this tutorial you'll have a deeper understanding of many Python features. Here are some of the topics we'll cover:

  • How namespaces really work, after which you'll understand:
    • most of the differences between variables in other languages and Python, including
    • why Python has neither pass-by-value nor pass-by-reference function call semantics, or why sometimes variables passed to a function can be changed by it, and sometimes they cannot.
  • Iterables, iterators, and the iterator protocol, including how to add it to a class
  • How generators can make your code easier to read and understand
  • Creating classes without a class statement in order to better understand how they work
  • Bound versus unbound methods and interesting uses of the former
  • How and why you might want to create or use a partial function
  • Other use-cases of functions as first-class citizens
  • Unpacking and packing arguments with * and ** on function call and definition

Attendee Requirements

Bring a laptop computer with a recent version of Python 2.7 or Python 3 installed.

Prerequisites

Intermediate ability in Python and little or no fear of iterators, generators, classes, methods, and how to call a function that's stored in a data structure.