3 ms·
I believe Go is weaker than Python. Python dataclasses/attrs (effectively structs) raise an error instead of silently doing the wrong thing, if you omit a const
by jimbo1qaz 7y ago
I believe Go is weaker than Python. Python dataclasses/attrs (effectively structs) raise an error instead of silently doing the wrong thing, if you omit a constructor keyword parameter. You can still supply default values, which makes the corresponding constructor parameters optional.
Keep in mind that dataclass defaults suffer from the same "mutable default arguments" issue as function parameters.