Closed
Description
test_inner_class_attribute.py:
class Foo:
class Meta:
name = 'Roy'
print(Foo().Meta.name)
Python executes the code just fine:
$ python3.6 test_inner_class_attribute.py
Roy
But mypy fails to typecheck
$ mypy test_inner_class_attribute.py
test_inner_class_attribute.py:5: error: Member "Meta" is not assignable
This pattern is super common in the Django Rest Framework, Marshmallow, and PynamoDB projects (Probably more that I don't know about as well 😄 )
Metadata
Metadata
Assignees
Labels
No labels