My limited experience in python shows that
class Person:
def __init__(self):
self.data: Tuple[int, str] = (5, "M")
print("DONE")
is more common than
class Person:
data: Tuple[int, str] = (5, "M")
def __init__(self):
print("DONE")
Any reason to favor the first version?
This is creating different attributes, the first one is an instance attribute (unique to each instance of the object), the second a class attribute, that is shared among the objects of this class.
Here is a quick demo (I changed the attribute to a mutable object):
Now let's mutate one object and looks at the other: