Skip to content

Commit 12bfe00

Browse files
committed
Flesh out the documentation a bit
1 parent 208e0a0 commit 12bfe00

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/source/command_line.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,21 @@ potentially problematic or redundant in some way.
503503
being instantiated which has attributes that were declared but never
504504
initialized.
505505

506-
(TODO: give examples)
506+
For example, in the following code, mypy will warn that ``value`` was not
507+
initialized.
508+
509+
.. code-block:: python
510+
511+
class Foo:
512+
value: int
513+
def __init__(self) -> None:
514+
self.vaelu = 3 # typo in variable name
515+
foo = Foo() # Error: 'value' is uninitialized
516+
517+
.. note::
507518

519+
Mypy cannot properly detect initialization in very dynamic code like
520+
classes with a custom ``__new__`` method.
508521

509522
.. _miscellaneous-strictness-flags:
510523

0 commit comments

Comments
 (0)