3 ms·
Sure, but most python code isn't annotated, right? So this might be helpful for code you wrote, but not anywhere it interfaces with other peoples' code (which,
by striking 10y ago
Sure, but most python code isn't annotated, right?
So this might be helpful for code you wrote, but not anywhere it interfaces with other peoples' code (which, in my opinion, is probably the most important place to check for type errors).
- Rapzid 10y agoPlus, many packages dynamically add members, stomp named parameters by wrapping stuff with kwargs, etc.
- humanfromearth 10y agoSo monkey patching is bad you're saying? I agree that it's possible what you're saying about kwargs, but after about 6 years of python I've never encountered that in any of the code that I've worked on.
- humanfromearth 10y agoTrue, but very popular packages are usually battle tested and type errors are very rare in practice in those packages. Most bugs I've seen are not because of the lack of a static type system.
- asddddd 10y agoThe older method is docstrings (reST and similar) like here: https://github.com/kennethreitz/requests/blob/master/requests/api.py#L16 https://github.com/kennethreitz/requests/blob/master/request... IDEs like PyCharm can use those and other methods to find most typing issues. In practice this is very effective for most "boring" Python code, but if you get really clever it falls over completely.