Define null values for enums #6095
Labels
feature
Is an improvement or enhancement
good first issue
Good for newcomers
help wanted
Open to be worked on
let's do it!
approved to implement
refactor
won't fix
This will not be worked on
🚀 Feature
Create null values for enums instead of using
None
. For example,utilities.enums.DistributedType
should have aDistributedTypes.None
enum value in addition to existing enum values.Motivation
Python builtin
None
is hard to track, and I think it is always a good practice to have default null values for enums in compensation for the lack of null safety of Python. It is especially beneficial when a variable holding a type of enum will beNone
, which is the case forDistributedType
intrainer.connectors.accelerator_connector
.Pitch
Define null values for enums, we can:
None
, facilitating code analysisNone
)Null pointer exception
/None does not have method/attribute
error.Additional context
When fixing #5966 in #5970, I have to take special care of
None
ofself._distrib_type
, which is a bit annoying.The text was updated successfully, but these errors were encountered: