from dataclasses import dataclass
from dataclasses import field
@dataclass
class Example:
a: int
b: int
c: int = field(default=-2)
print(Example(1, 2).c) # prints -1
print(Example(1, 2, 3).c) # prints 3
ZnJvbSBkYXRhY2xhc3NlcyBpbXBvcnQgZGF0YWNsYXNzCmZyb20gZGF0YWNsYXNzZXMgaW1wb3J0IGZpZWxkCgpAZGF0YWNsYXNzCmNsYXNzIEV4YW1wbGU6CiAgICBhOiBpbnQKICAgIGI6IGludAogICAgYzogaW50ID0gZmllbGQoZGVmYXVsdD0tMikKCnByaW50KEV4YW1wbGUoMSwgMikuYykgIyBwcmludHMgLTEKcHJpbnQoRXhhbXBsZSgxLCAyLCAzKS5jKSAjIHByaW50cyAz