For example:

class FooBar:
    def __init__(self):
        self.a: int = None
        self.foo: str = None

Is this bad practice/go against PEP guidelines or is it fine?

you are viewing a single comment's thread
view the rest of the comments
[–] 21 points 7 months ago (1 child)

Implicit optional is deprecated. Explicitly use self.foo: int | None = None

  • source
  • hideshow 1 child comment