Closed johnthagen closed 4 years ago
It would be useful if, rather than having to add a default (potentially meaningless) value to a field, instead you could mark it as Optional.
Optional
from dataclasses import dataclass from typing import Optional @dataclass class User: firstname: str email: Optional[str] age: int
If the field is not provided in the row, the field is set to None. This will allow for a type-safe way to detect and handle missing values.
None
This feature has been already implemented. Closing it.
It would be useful if, rather than having to add a default (potentially meaningless) value to a field, instead you could mark it as
Optional
.If the field is not provided in the row, the field is set to
None
. This will allow for a type-safe way to detect and handle missing values.