control initialize order when Python dataclass inheriting a class

Actually there is one method which is called before __init__: it is __new__. So you can do such a trick: call Base.__init__ in Child.__new__. I can't say is it a good solution, but if you're interested, here is a working example:

class Base:
    def __init__(self, a=1):
        self.a = a


@dataclass
class Child(Base):
    a: int

    def __new__(cls, *args, **kwargs):
        obj = object.__new__(cls)
        Base.__init__(obj, *args, **kwargs)
        return obj


c = Child(a=3)
print(c.a)  # 3, not 1, because Child.__init__ overrides a

In best practice [...], when we do inheritance, the initialization should be called first.

This is a reasonable best practice to follow, but in the particular case of dataclasses, it doesn't make any sense.

There are two reasons for calling a parent's constructor, 1) to instantiate arguments that are to be handled by the parent's constructor, and 2) to run any logic in the parent constructor that needs to happen before instantiation.

Dataclasses already handles the first one for us:

 @dataclass
class A:
    var_1: str

@dataclass
class B(A):
    var_2: str

print(B(var_1='a', var_2='b'))  # prints: B(var_1='a', var_2='b')
# 'var_a' got handled without us needing to do anything

And the second one does not apply to dataclasses. Other classes might do all kinds of strange things in their constructor, but dataclasses do exactly one thing: They assign the input arguments to their attributes. If they need to do anything else (that can't by handled by a __post_init__), you might be writing a class that shouldn't be a dataclass.