Hacker News new | past | comments | ask | show | jobs | submit login

When exactly are you expecting Python, an interpreted language, to raise a compiler error?



You can raise the error as soon as the match operator is executed. Even if match has a valid match with the expression, if all the branches aren't evaluated the function can still raise an error.

This allows for early catching of logic errors during unit testing and negates the need for additional tests.


I guess, but I think a possible solution here would be a pylint plugin to show a warning so you don't have to wait for a runtime exception.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: