File tree 1 file changed +24
-0
lines changed 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,30 @@ We also have to generate getters/setters to make sure they stay in sync, which
130
130
dramatically increases the amount of code generated since these need to
131
131
appear in every referencing structure.
132
132
133
+ ### intEnums
134
+
135
+ ``` python ```
136
+ class MyIntEnum(IntEnum):
137
+ SPAM = 1
138
+ EGGS = 2
139
+ ``````
140
+
141
+ IntEnums will use the native `IntEnum` type. This will allow customers to
142
+ easily specify the enum value without having to reference the actual number. It
143
+ also gives them a programmatic way to list known values.
144
+
145
+ Like string enums, members targeting IntEnums will use plain integers to enable
146
+ forwards compatibility and type checking. Documentation for those members will
147
+ reference the generated classes for discoverability.
148
+
149
+ #### Alternative: target the generated enums
150
+
151
+ In this alternative, members targeting IntEnums would reference the generated
152
+ classes. This wasn't chosen for both forwards and backwards compatibility reasons.
153
+ While one can mostly use IntEnums and integers interchangeably, the types *are*
154
+ different. Type checking would fail if you provided a base integer, known or
155
+ unknown.
156
+
133
157
### streaming blobs
134
158
135
159
A blob with the streaming trait will continue to support `bytes` as input.
You can’t perform that action at this time.
0 commit comments