Skip to content

Instantly share code, notes, and snippets.

@tal95shah
Created July 10, 2018 14:40
Show Gist options
  • Select an option

  • Save tal95shah/137608d0aab8ee0691acf67740cb2d5c to your computer and use it in GitHub Desktop.

Select an option

Save tal95shah/137608d0aab8ee0691acf67740cb2d5c to your computer and use it in GitHub Desktop.
Inheritance used in dataclasses.
from dataclasses import dataclass
from typing import Any
@dataclass
class Customer(object):
customer_id: Any = 2.0
name: str = ""
@dataclass
class CustomerExtended(Customer):
address: str = ""
customer_id: int = 1
if __name__ == '__main__':
ce = CustomerExtended()
print("ce:{}".format(ce))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment