One of the tests explicitly disallows this, which is the cause for my PR #2829 failing. I've removed it in the PR, but is there a reason to have it there in the first place?
I have a feeling that this has been discussed earlier. Anyway, it's a matter of style -- the code is clearly correct. I wonder if @gvanrossum has an opinion whether fn2 should be accepted.
I'm torn, since I sometimes do this myself, but I do think it's a (very slight) code smell. I also think that fn1() and fn2() should either both be errors or both pass (both have a -> None and a return EXPR where EXPR is known to have the value None).
Activity
TRManderson commented on Feb 8, 2017
One of the tests explicitly disallows this, which is the cause for my PR #2829 failing. I've removed it in the PR, but is there a reason to have it there in the first place?
JukkaL commented on Feb 24, 2017
I have a feeling that this has been discussed earlier. Anyway, it's a matter of style -- the code is clearly correct. I wonder if @gvanrossum has an opinion whether fn2 should be accepted.
gvanrossum commented on Feb 25, 2017
I'm torn, since I sometimes do this myself, but I do think it's a (very slight) code smell. I also think that fn1() and fn2() should either both be errors or both pass (both have a -> None and a return EXPR where EXPR is known to have the value None).
ddfisher commented on Feb 27, 2017
For what it's worth, this is allowed with --strict-optional.
JukkaL commented on Feb 28, 2017
If it's only a very slight code smell, mypy should perhaps not complain about it.
gvanrossum commented on Feb 28, 2017
msullivan commented on Jan 28, 2020
This is fixed