File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -274,12 +274,13 @@ Because it is possible to attempt to narrow B,
274
274
but A does not have appropriate information about B
275
275
(or any other unknown subclass of A!) it's not possible to safely narrow
276
276
in either direction. The general rule for generics is that if you do not know
277
- all the places a generic class is generic and do not enough of them to be
277
+ all the places a generic class is generic and do not check enough of them to be
278
278
absolutely certain, you cannot return True, and if you do not have a definitive
279
279
counter example to the type to be narrowed to you cannot return False.
280
280
In practice, if soundness is prioritized over an unsafe narrowing,
281
- not knowing what you don't know is solvable by erroring out
282
- or by making the class to be narrowed final to avoid such a situation.
281
+ not knowing what you don't know is solvable by either
282
+ erroring out when neither return option is safe, or by making the class to be
283
+ narrowed final to avoid such a situation.
283
284
284
285
In practice, such correctness is not always neccessary, and may work against
285
286
your needs. for example, if you trust that users implementing
You can’t perform that action at this time.
0 commit comments