4 ms·
I don't get what's so bad about assertions. It makes it much easier to demand that a given object has a given method than forcing the object to be of a certain
by zeth___ 8y ago
I don't get what's so bad about assertions. It makes it much easier to demand that a given object has a given method than forcing the object to be of a certain class.
If anything adding a list of assertions at the top of a method/function/class is much more readable than the current type hint implementation.
And if you're running out of resources move the assertions to your regression tests.
- benji-york 8y ago> And if you're running out of resources move the assertions to your regression tests. Or run Python with -O, which skips assertions.
- wnoise 8y ago> It makes it much easier to demand that a given object has a given method than forcing the object to be of a certain class. You know what's even easier? Calling the method. Gives as much useful information in the case of a failure, and also only checks at runtime. I want something that can check earlier than that, in two ways: before running, and up the call stack.
- zeth___ 8y agoOk. Then why would you use a weakly typed language where the idea of types can be easily and completely subverted with monkey patching?
- wnoise 8y agoLibrary selection, currently running infrastructure, modifying existing applications, etc, etc. It doesn't have to work 100% of the time if the 99% of the time it does work it's capable of catching serious errors earlier.
- zeth___ 8y agoAs someone whose used python since the 2.1 days in high school, why not create a language with the type system you want instead of killing python? There is a reason why python is this good when it specifically chose to not implement the features that are now being added to it.