Skip to content

Commit

Permalink
minor rewording
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshardmind committed Jul 20, 2024
1 parent 4a30dc9 commit 2b8c1f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/spec/narrowing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,13 @@ Because it is possible to attempt to narrow B,
but A does not have appropriate information about B
(or any other unknown subclass of A!) it's not possible to safely narrow
in either direction. The general rule for generics is that if you do not know
all the places a generic class is generic and do not enough of them to be
all the places a generic class is generic and do not check enough of them to be
absolutely certain, you cannot return True, and if you do not have a definitive
counter example to the type to be narrowed to you cannot return False.
In practice, if soundness is prioritized over an unsafe narrowing,
not knowing what you don't know is solvable by erroring out
or by making the class to be narrowed final to avoid such a situation.
not knowing what you don't know is solvable by either
erroring out when neither return option is safe, or by making the class to be
narrowed final to avoid such a situation.

In practice, such correctness is not always neccessary, and may work against
your needs. for example, if you trust that users implementing
Expand Down

0 comments on commit 2b8c1f2

Please sign in to comment.