Loading topic
Enum class, as covered in the previous chapter, and that you know the difference between == and is. Here you will learn how to get at a member's name and value, how to find a member from a name or a value, and what happens when the lookup fails.5 min readEnum class and read .name and .value. It also assumes you know the difference between == and is, and that you can loop over a collection. By the end you will know which members iteration returns and which it skips. You will also know how Python d5 min readEnum, looking members up by name and value, and iterating over members and aliases. You should also be comfortable applying a decorator to a class and catching exceptions with try/except.6 min readEnum, read .name and .value, and iterate over members. It also assumes you know how class bodies run and what a decorator does. Here you will learn how auto() picks member values, how it behaves with mixed enum types, and how to replace its default4 min read== and is behave on them, and how members behave as dictionary keys and set elements. It assumes you can define an Enum class, you know the difference between == and is, and you know that a dictionary key m5 min read@property and @classmethod, and know th5 min readEnum, read .name and .value, and look members up with Color(2) or Color["BLUE"]. It also assumes you know the difference between == and is, and that you have written a basic match statement. The chapter covers three places where enums do the mos6 min readEnum, read .name and .value, and look members up by value. It also assumes you know the difference between == and is, and that you can read a class that inherits from another class. The examples use Python 3.11 or newer, because StrEnum was add5 min readEnum, use auto(), and compare members with == and is. It also assumes you know that integers are stored as bits. The examples assume Python 3.11 or later. Where earlier versions behave differently, the text says so.5 min readEnum, read .name and .value, and look members up by value or name. It also assumes you know Enum, IntEnum, StrEnum, Flag and auto(), and the difference between == and is. Most enum bugs come from a few surprises that follow from how the modu5 min readEnum, know that members have .name and .value, and understand how aliases and auto() assign values. You also need to be comfortable calling a class to create an object. Here you will build enums by calling Enum like a function instead of wri6 min readEnum class finds members and how it numbers them: _missing_ and _generate_next_value_. It assumes you know how Color(2) and Color["BLUE"] work, what auto() does, and how classmethods and staticmethods are defined. The examples were written5 min read