Setting instance data attributes to None in __init__ In Python 3.7, I frequently find myself writing something like this in __init__:
    self.foo: Optional[Foo] = None

For example:
window = Window()
# do some more setup here before going to user
path = get_path_from_user()
window.build(path)

class Window:
    def __init__(self):
        self.image: Optional[Image] = None

    def build(self, path):
        self.image = Image(path)

I justify this to myself as:

Wishing to keep __init__ light (for maximum reuseabilty) or
Being unable to complete the instance when __init__ executes.

However, I typically don't use the None value for any real meaning in the code. In this example, suppose a Window is meaningless without an image. It's just a placeholder until build is called so...
Is this an anti-pattern when doing so for either of the two reasons?
If so, what is a better way to do it?
(Your opinion is what I'm seeking)
Simply removing the line from __init__ flags a code inspection warning in PyCharm: &quot;Instance Attribute instantiated outside __init__&quot;. This seems reasonable to me as it ensures I'm able to look in __init__ and know I'm always seeing all the data attributes.
According to PEP 526, the initializer isn't needed.  Have you tried:
class Window:
    def __init__(self):
        self.image: Optional[Image]    # &lt;== this is just a type hint, no initialization

    def build(self, path):
        self.image = Image(path)

I don't use PyCharm, so I don't know if it would still complain.