News for hackers. Stuff that matters.
Re:Strong typing, a hill I'm willing to die on by drekipus on Wednesday October 04, 2023 @08:30PM (#37773499)
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
Re:Strong typing, a hill I'm willing to die on by packetlost on Wednesday October 04, 2023 @11:35PM (#37774655)
In code review, explain what can go wrong and offer suggestions for how to write it such that it doesn't have those problems?
Re:Strong typing, a hill I'm willing to die on by jpc0 on Thursday October 05, 2023 @10:59AM (#37779461)
While 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.