Created
December 13, 2021 19:28
-
-
Save bryanmylee/883b74067cb6701b113186c001bf72d4 to your computer and use it in GitHub Desktop.
Using `field` to customize field properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass, field | |
from typing import FrozenSet | |
@dataclass(frozen=True, eq=True) | |
class Ingredient: | |
id: str | |
g_per_ml: float | |
substitution_ids: FrozenSet[str] = field( | |
default_factory=lambda: frozenset(), compare=False | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment