Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Building Enumerations With Python's enum (Summary)

Now you have a solid understanding of how to create and utilize enumerations in Python. Enumerations, also known as enums, are common data types in many programming languages. By using enums, you can organize related constants into groups and access them through the enumeration itself.

Although Python doesn’t have a specific syntax for enums, you can still create them by making use of the Enum class from the enum module.

In this video course, you’ve learned how to:

  • Create your own enumerations using Python’s Enum class
  • Work with enums and their members
  • Extend the capabilities of your enum classes by adding additional functionalities
  • Apply enums in practical situations with real-world examples

You’ve also gotten to know other valuable enumeration types, such as IntEnum, IntFlag, and Flag. These types are available in the enum module and enable you to create specialized enums.

With all this newfound knowledge, you’re now equipped to leverage Python’s enums to organize, name, and handle sets of logically related constants. Enumerations provide a way to structure your code in a more readable, explicit, and maintainable manner.

Download

Sample Code (.zip)

583 bytes
Download

Course Slides (.pdf)

1.6 MB

Become a Member to join the conversation.