Python typing for variable declaration inside __init__

Keywords: python python-3.x typing typechecking


I'm wondering if this is the correct way to use type checking inside __init__. I'm setting these variables to 'empty' as they will be set within other methods. Is that the best practice way when using typing?

Does it make sense for more custom data types like dataframe?


from collections import Counter
from typing import Dict
import pandas as pd

class Example:

    def __init__(self):
        self.sentence: Dict[str, list] = {}
        self.counter: Counter = Counter()
        self.df: pd.DataFrame = pd.DataFrame()