4 ms·
I guess I meant what do you do to prevent that from happening.
by uptownfunk 4y ago
I guess I meant what do you do to prevent that from happening.
- mianos 4y agoThat is my point. I don't have any tools to prevent it from happening. I just don't do it when I write the code. If I have and my code is tested it comes up very quickly. Us older people tend to keep the whole workflow as simple as possible. That is why I love python. There is very little overhead to just using it. If you tend to make this mistake a lot it might make sense to add some tooling. I don't need it. If I wanted strict typing I would probably just use C++.
- your_neighbor 4y agoYou do get type errors, but you catch them with tests? Type hinting catches them without having to write tests.
- BoorishBears 4y agoI think you're either misrepresenting reality or stretching the truth. For example, if you're redefining bug as "bug that made it past testing" that's one thing. But I don't buy anyone writing Python daily for 15 years hasn't seen the term "TypeError" which is what your previous two comments were implying.
- mianos 4y agoOK, it's 100% likely I saw it, just so rarely I can't remember. Testing. Over that long time I have used many test frameworks. My normal workflow is to try and exercise all the code I write as I go. On the other hand I am 100% pedantic about using 'schema' (https://pypi.org/project/schema/ https://pypi.org/project/schema/) to validate all the types, structure and domains when I read json.
- mharig 4y agoNearly the same here. The only type error I make a little bit more than I would like, is expecting an iterable and passing a string instead, because I forgot parentheses around arguments. But I made way more type errors when programming in C/++. Why do you prefer schema to (fast)jsonschema?
- mianos 4y ago'schema' is more a schema enhanced by python than just a checker. It can convert types, set defaults so after 'Box' I can simple access config with a.b.c. It may be subtle but it is much more powerful than it looks. There are many of these things. Maybe some are better but I like this one.
- uptownfunk 4y agoSo you use some type of testing methodology for your code?