mypy does *not* warn “missing return statement” if the last line of a function body is a raise statement. It does if the last line is instead a call to a function which does nothing but raise an exception. Is this a bug? A known bug? It feels bug-like to me.
So, for example, if you have a function error_raiser() in which all paths lead to a raise statement, and the last line of function foo() is a call to error_raiser(), mypy says “missing return” even though an exception is guaranteed.
-
-
Asking because it seems that if you do centralized error handling like this, mypy either requires you turn off warnings for missing return statements, or throw in unreachable return or “assert False” statements to appease it.
Prikaži ovu nitHvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.