e-learning

Python - Type annotations

Abstract

In some languages type annotations are a core part of the language and types are checked at compile time, to ensure your code can never use the incorrect type of object. Python, and a few other dynamic languages, instead use "Duck Typing" wherein the type of the object is less important than whether or not the correct methods or attributes are available.

About This Material

This is a Hands-on Tutorial from the GTN which is usable either for individual self-study, or as a teaching material in a classroom.

Questions this will address

  • What is typing?
  • How does it improve code?
  • Can it help me?

Learning Objectives

  • Understand the utility of annotating types on one's code
  • Understand the limits of type annotations in python

Licence: Creative Commons Attribution 4.0 International

Keywords: Foundations of Data Science, jupyter-notebook

Target audience: Students

Resource type: e-learning

Version: 2

Status: Active

Learning objectives:

  • Understand the utility of annotating types on one's code
  • Understand the limits of type annotations in python

Date modified: 2023-02-13

Date published: 2022-10-19

Authors: Helena Rasche

Contributors: Bazante Sanders, Donny Vrins, Marius van den Beek, Peter van Heusden

Scientific topics: Software engineering


Activity log