5 ms·
Since using Rust, I've longed for this in Python but - imo it effectively requires using type checking (mypy) - Too out of place with the rest of the python e
by epage 8y ago
Since using Rust, I've longed for this in Python but
- imo it effectively requires using type checking (mypy)
- Too out of place with the rest of the python ecosystem (even if I like something, I'd rather not force non-standard practices on others dealing with my code)
- StavrosK 8y agoI don't know, for things where you can get team buy-in, this looks like a great way to have more solid contracts. I've always disliked how you can specify accept/return types in Python but then there's this whole side-channel of exceptions that you can't check or document well.
- futureastronaut 8y agoHow familiar are you with Java?
- X-Istence 8y agoI was about to post something similar to this. In java you need to specify what your function can throw and if it tries to throw something that it has not specified as being able to throw, then your program won't compile.
- StavrosK 8y agoThat's an acceptable solution as well.
- weberc2 8y agoAgreed, checked exceptions solve the same problem, but having separate control flow mechanism for certain kinds of data still seems subpar. Return values can solve the same problems and are more general.
- AstralStorm 8y agoNot if you cannot enforce them to be checked.
- StavrosK 8y agoNot enough to have PTSD from it, why?
- futureastronaut 8y agoMaybe you should be familiar with it.
- StavrosK 8y agoCool, I'll file it under "to maybe be familiar with, things", thanks.
- futureastronaut 8y agoOr mention "PTSD" when somebody brings up Java to signal that you're above such foolishness, and rely on nobody seeking an explanation for your aversion.