Hello Types

Speaker: Sheena O'Connell

Track: Other

Type: Tutorial

Room: Yellowwood

Time: Oct 10 (Wed), 09:00

Duration: 4:00

Introduction

Lately there has been drive toward adding static typing to dynamically typed languages. Clojure, Javascript and Lua are some examples of this. And of course Python. Why? Because it's a damn fine idea! Having a variable and knowing what it is and how it behaves and being able to enforce that in your code is golden.

In this tutorial session we'll briefly cover some of the pros and cons of Python type checking (mostly the pros to be honest) and then get our hands dirty. We'll start off with writing some fresh code and adding Type annotations as we go. We'll then cover a bit of how to add type checking to pre-existing codebases.

Prerequisite skillz:

Basic knowledge of Python. If you can run your code and you are comfortable with the syntax around variables, functions, classes and loops then you should be quite comfortable. It would also be useful if you know how to drive a virtalenvironment but this is not strictly necessary.

Prerequisite tech:

We'll be working in both Python2 and 3. You'll need to bring a laptop with the following things installed:

  • Python3.5 (higher version numbers are welcome)
  • Python2.7

What we'll cover

  • What is type checking and why should we use it?
  • Python3 type annotations
  • Python2 type annotations
  • Adding annotations to existing projects

By the end of this you...

Should be able to consistently write saner, more robust and more explicit code. Which is always a worthwhile goal