Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Peacock - Getting Started with Statically Typed Programming in Python 3.10

PyCon US via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore statically typed programming in Python 3.10 through this informative PyCon US talk. Discover the advantages of using type hints, learn how to leverage editor support, and streamline code reviews. Dive into essential concepts such as argument and return types for functions, standard collection types, and the distinctions between tuples and other types. Gain insights into abstract and concrete types, generics, and user-defined types. Explore recent type hinting updates in Python 3.9 and 3.10, including generics in standard collections, union types, parameter specification variables, explicit type aliases, and user-defined type guards. Understand the relationship between various collection types and learn best practices for using them effectively. Delve into the future module and new features in Python 3.11 related to typing. By the end of this talk, acquire a solid foundation in statically typed programming in Python, enhancing your development experience and code quality.

Syllabus

Getting Started with Statically Typed Programming in Python 3.10
Let's start with function definitions Nothing too difficult Just write type . After the arguments, write colon and the type . Before the colon at the end of the function definition write an arrow and the type
Escaping from complex type puzzles • Any can hold instances of any type • It's better not to use it • Import and use from typing when necessary
Using types from collections.abc differently • There are many types in collections.abe" . It's better to use a collection with a few methods to increase portability • Ex. 'Iterable is better than "list • It's a good idea to look at the methods used in your functions The figure on the next page shows the relationship...
The differences between tuple and other Sequences • tuple' is fixed up to the length of information • Specify the type for the number of elements . Or you can mix types, such as tuple int
A sequence, such as a list has the same constraint for all elements . Can be used regardless of the length of the Sequence by setting only one
User-defined Generic types Example: a generic mapping type
What is the future. module? . Using typing new feature in the older versions, write
New Features on Type Hints in 3.10 • PEP 504: New Type Union Operator • PEP 512 Parameter Specification Variables
PEP 612: Parameter Specification Variables Motivation Needed a way to represent a function that has the same arguments as the specified function
PEP 647: User-Defined Type Guards Motivation • Type checker tools use a technique called type narrowing to determine the type of information
New Feature on Type Hints in 3.11 Python 3.11 is focused on performance tuning but there are also new features in Typing
Summary 1. Benefits, starting with def , Built-in types 2. Standard collections since 39 3. Collections, Union, Optional Callable. User-defined Generics

Taught by

PyCon US

Reviews

Start your review of Peacock - Getting Started with Statically Typed Programming in Python 3.10

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.