Created
February 23, 2021 00:10
-
-
Save iamjjanga-ouo/5aeb0eb50735bada8a5cdf64b7e2654e to your computer and use it in GitHub Desktop.
Python: @DataClass decoration example
This file contains 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
# python 3.7+ | |
from dataclasses import dataclass | |
@dataclass | |
class Product: | |
weight: int = None | |
price: float = None | |
apple = Product() | |
apple.price = 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment