4 ms·
I have this all the time at work. We have large python codebase, all sorts of linters and checks. Still have developers do something like: # we have a li
by drekipus 3y ago
I have this all the time at work.
We have large python codebase, all sorts of linters and checks.
Still have developers do something like:
# we have a list of things
# but we only need one
try:
a_thing = things[0]
except IndexError:
pass
assert isinstance(a_thing, Thing)
Sure maybe it's a junior thing. But it still happens, and the typing doesn't save us. I don't know how to tell juniors to stop doing this
- packetlost 3y agoIn code review, explain what can go wrong and offer suggestions for how to write it such that it doesn't have those problems?
- qzb 3y ago[dead]
- jpc0 3y agoWhile discussing code review, howabout shooting whoever wrote that comment. Why is there an assert? Python case a cast function if you really wanted to force the typechecker to see a_thing as Thing but (and I'm sure this is the point you are making) you are likely hiding a prolem.