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

Python Epiphanies

Translations: en en

Description

This tutorial is for developers who've been using Python for a while and would consider themselves at an intermediate level, but are looking for a deeper understanding of the language. It focuses on how Python differs from other languages in subtle but important ways that are often confusing, and it demystifies a number of language features that are sometimes misunderstood.

In many ways Python is very similar to other programming languages. However, in a few subtle ways it is quite different, and many software developers new to Python, after their initial successes, hit a plateau and have difficulty getting past it. Others don't hit or perceive a plateau, but still find some of Python's features a little mysterious or confusing. This tutorial will help deconstruct some common incorrect assumptions about Python.

If in your use of Python you sometimes feel like an outsider, like you're missing the inside jokes, like you have most of the puzzle pieces but they don't quite fit together yet, or like there are parts of Python you just don't get, 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 objects are created and names are assigned to them
  • Ways to modify a namespace: assignment, import, function definition and call, and class definition and instantiation. Much of the tutorial is structured around namespaces and how they get modified to help you understand most of the differences between variables in other languages and those in Python, including
    • why Python has neither pass-by-value nor pass-by-reference function call semantics,
    • and why parameters passed to a function can sometimes be changed by it and sometimes cannot.
  • Iterables, iterators, and the iterator protocol, including how to make class instances iterable
  • How to use generators to make your code easier to read and understand
  • Hacking classes after their definition, and creating classes without a class statement, as an exercise to better understand how they work
  • Bound versus unbound methods, how they're implemented, and interesting things you can do with bound methods
  • How and why you might want to create or use a partial function
  • Example use-cases of functions as first-class objects
  • Unpacking and packing arguments with * and ** on function call and definition

Bring a laptop with Python 3 and Jupyter Notebook.

Details

Improve this page