← Winnitude! Search  ·  Reader Mode (800 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
REAL PYTHON · Real Python · 43 LINKS

Building Enumerations With Python's enum - Real Python

Go to the next lesson

Building Enumerations With Python's enum

Darren Jones 18 Lessons 1h 48m intermediate data-structures python stdlib

Some programming languages, such as Java and C++, have built-in support for a data type called enumerations , commonly referred to as enums . Enums enable you to create sets of logically related constants that you can access through the enumeration itself. Unlike these languages, Python doesn't have a dedicated syntax for enums. However, the Python standard library provides an enum module that offers support for enumerations through the Enum class.

If you're familiar with enums from other languages and wish to use them in Python, or if you simply want to learn how to work with enumerations, then this video course is designed for you.

In this video course, you'll discover how to:

  • Create enumerations of constants using Python's Enum class
  • Interact with enumerations and their members in Python
  • Customize enumeration classes by adding new functionalities
  • Apply practical examples to gain a deeper understanding of the benefits of using enumerations

Additionally, you'll explore other specific enumeration types available in the enum module, such as IntEnum, IntFlag, and Flag. These specialized enums will expand your repertoire.

To get the most out of this video course, you should be familiar with object-oriented programming and inheritance in Python.

What's Included:

  • 18 Lessons
  • Video Subtitles and Full Transcripts
  • Translated Subtitles in 8 Languages
  • 2 Downloadable Resources
  • Accompanying Text-Based Tutorial
  • 5 Hands-On Coding Exercises
  • Q&A With Python Experts: Ask a Question
  • Certificate of Completion

Downloadable Resources:

Related Learning Paths:

Start Now

Getting to Know Enumerations in Python

2 Lessons 5m

  1. 1. Building Enumerations With Python's enum (Overview) 02:06
  2. 2. Getting to Know Enumerations 03:41

Creating Enumerations With Python's enum

5 Lessons 25m

  1. 1. Creating Enumerations in Python 05:28
  2. 2. Creating More Enumerations 02:53
  3. 3. Creating Enumerations With the Functional API 05:26
  4. 4. Using Automatic Values, Aliases, and Unique Values 03:58
  5. 5. Exercise: Cardinal Directions With auto() 08:00

Working With Enumerations in Python

4 Lessons 21m

  1. 1. Working With Enumerations in Python 04:37
  2. 2. Using Enumerations in if and match Statements 02:55
  3. 3. Comparing and Sorting Enumerations 05:52
  4. 4. Exercise: Sort Enum Members by Name or Value 08:00

Diving Deeper Into Enumerations

4 Lessons 32m

  1. 1. Extending Enumerations With New Behavior 06:51
  2. 2. Exercise: Sorting Strategies With a Callable Enum 09:30
  3. 3. Exploring Other Enumeration Classes 07:43
  4. 4. Exercise: User Roles With IntFlag 08:00

Reviewing What You've Learned

3 Lessons 22m

  1. 1. Using Enumerations: Two Practical Examples 07:07
  2. 2. Exercise: Disk Player State Machine 14:30
  3. 3. Building Enumerations With Python's enum (Summary) 01:20
Start Now

About Darren Jones

With 20 years as a teacher of music technology, Darren is keen to bring his skills to the Python table.

» More about Darren

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Aldren

Christopher

Kate

Tappan

Leodanis

Geir Arne

Bartosz

Brenda

← Browse All Courses