@@ -551,7 +551,7 @@ potentially problematic or redundant in some way.
551551 .. note ::
552552
553553 Mypy currently cannot detect and report unreachable or redundant code
554- inside any functions using :ref: `type-variable-value-restriction `.
554+ inside any functions using :ref: `value-constrained type variables < value-constrained-type-variables > `.
555555
556556 This limitation will be removed in future releases of mypy.
557557
@@ -598,8 +598,8 @@ of the above sections.
598598.. option :: --allow-redefinition-new
599599
600600 By default, mypy won't allow a variable to be redefined with an
601- unrelated type. This * experimental * flag enables the redefinition of
602- unannotated variables with an arbitrary type. You will also need to enable
601+ unrelated type. This flag enables the redefinition of * unannotated *
602+ variables with an arbitrary type. You will also need to enable
603603 :option: `--local-partial-types <mypy --local-partial-types> `.
604604 Example:
605605
@@ -631,12 +631,30 @@ of the above sections.
631631 # Type of "x" is "str" here.
632632 ...
633633
634+ Function arguments are special, changing their type within function body
635+ is allowed even if they are annotated, but that annotation is used to infer
636+ types of r.h.s. of all subsequent assignments. Such middle-ground semantics
637+ provides good balance for majority of common use cases. For example:
638+
639+ .. code-block :: python
640+
641+ def process (values : list[float ]) -> None :
642+ if not values:
643+ values = [0 , 0 , 0 ]
644+ reveal_type(values) # Revealed type is list[float]
645+
634646 Note: We are planning to turn this flag on by default in a future mypy
635647 release, along with :option: `--local-partial-types <mypy --local-partial-types> `.
636- The feature is still experimental, and the semantics may still change.
637648
638649.. option :: --allow-redefinition
639650
651+ This is an alias to :option: `--allow-redefinition-old <mypy --allow-redefinition-old> `.
652+ In mypy v2.0 this will point to
653+ :option: `--allow-redefinition-new <mypy --allow-redefinition-new> `, and will
654+ eventually became the default.
655+
656+ .. option :: --allow-redefinition-old
657+
640658 This is an older variant of
641659 :option: `--allow-redefinition-new <mypy --allow-redefinition-new> `.
642660 This flag enables redefinition of a variable with an
@@ -689,7 +707,7 @@ of the above sections.
689707 reveal_type(Foo().bar) # 'int | None' without --local-partial-types
690708
691709 Note: this option is always implicitly enabled in mypy daemon and will become
692- enabled by default for mypy in a future release.
710+ enabled by default in mypy v2.0 release.
693711
694712.. option :: --no-implicit-reexport
695713
@@ -1000,9 +1018,10 @@ beyond what incremental mode can offer, try running mypy in
10001018 writing to the cache, use ``--cache-dir=/dev/null `` (UNIX)
10011019 or ``--cache-dir=nul `` (Windows).
10021020
1003- .. option :: --sqlite-cache
1021+ .. option :: --no- sqlite-cache
10041022
1005- Use an `SQLite `_ database to store the cache.
1023+ Avoid using `SQLite `_ database to store the cache, instead write cache data
1024+ out to individual files.
10061025
10071026.. option :: --cache-fine-grained
10081027
0 commit comments