Skip to content

class instance has __dict__ #132

Closed
Closed
@tharvik

Description

@tharvik
class A:
    pass
A().__dict__

is a valid python3 statement but mypy (more a typeshed issue I guess) gives me

file:4: error: "A" has no attribute "__dict__"

So I modified added, in object, __dict__ = ... # type: Dict[str, Any] to stdlib/3/builtins.pyi which indeed make it warning-less.

But, it is wrong, as

object().__dict__

fail with an AttributeError.

Is there a better place to put this __dict__? Or is it a mypy issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions