Default Values for classes
You can't set a default value for classes in the __init__
function. For instance:
Wrong way
The above returns True
.
The appropriate pattern is to set the default to None
and adjust in the __init__
function.
Right Way
This now returns False
.
You could also use a ternary function.
Ternary Way
Last updated