Python logo

目錄

  • Enum HOWTO
    • Programmatic access to enumeration members and their attributes
    • Duplicating enum members and values
    • Ensuring unique enumeration values
    • Using automatic values
    • Iteration
    • 比較
    • Allowed members and attributes of enumerations
    • Restricted Enum subclassing
    • Dataclass support
    • Pickling
    • Functional API
    • Derived Enumerations
      • IntEnum
      • StrEnum
      • IntFlag
      • Flag
      • 其他
    • When to use __new__() vs. __init__()
    • Finer Points
      • 有支援的 __dunder__ 和 _sunder_ 名稱
      • _Private__names
      • Enum member type
      • Creating members that are mixed with other data types
      • Boolean value of Enum classes and members
      • Enum classes with methods
      • Flag 的成員組合
      • Flag and IntFlag minutia
    • Enums 和 Flags 有何不同?
      • Enum 類別
      • Flag 類別
      • Enum Members (aka instances)
      • Flag 成員
    • Enum Cookbook
      • 省略值
        • 使用 auto
        • 使用 object
        • Using a descriptive string
        • 使用自訂的 __new__()
      • OrderedEnum
      • DuplicateFreeEnum
      • MultiValueEnum
      • Planet
      • TimePeriod
    • 子類別化 EnumType

上個主題

使用 GDB 來為 C API 擴充功能和 CPython 內部偵錯

下個主題

函式程式設計 HOWTO

此頁面

  • 回報錯誤
  • 改進此頁面
  • 顯示原始碼
  • 顯示翻譯原始碼

導航

  • 索引
  • 模組 |
  • 下一頁 |
  • 上一頁 |
  • Python logo