|
|
|
|
|
by skrtskrt
1641 days ago
|
|
If you use the runtime type validators along with the python builtin type hints you constantly repeat yourself: id: UUID = attr.ib(validator=instance_of(UUID), …other parameters)
The type hint helps mypy and pylint work, while the validator is a runtime check by AttrsIf your attribute name is longer or you have other parameters to set, that can be a very long line (or lines) of code that you repeat for every attribute |
|