News for hackers. Stuff that matters.
Re:Systematically removing code by npsimons on Wednesday November 11, 2020 @11:47AM (#25059956)
> That's how. There are so many Python linters out there.

Ah, okay. I've been using pychecker, pyflakes and pylint for quite some time, was just hoping there was something more that would help do stricter type checking. I'm aware of python-contract as an orthogonal way to enforce things, but was a little disappointed it's not included with standard python (at work I don't always have the option of installing external packages).

Re:Systematically removing code by tech2 on Wednesday November 11, 2020 @12:04PM (#25060181)
Is using mypy for gradual typing not an option open to you?

http://mypy-lang.org/

Re:Systematically removing code by npsimons on Wednesday November 11, 2020 @12:22PM (#25060363)
It is at home! Thanks for the pointer!
Re:Systematically removing code by jmholla on Wednesday November 11, 2020 @12:06PM (#25060201)
There's mypy[0] which does actual type checking with effort on your end. It is an external dependency, but you've already printed to a few external dependencies you're leveraging.

[0]: http://mypy-lang.org/

Re:Systematically removing code by npsimons on Wednesday November 11, 2020 @12:21PM (#25060358)
"External" is relative; at home, I can install whatever I please, although I do prefer to stick to what is included with Debian stable, which is pretty comprehensive (it includes pychecker, pyflakes, pylint and python-contract). And indeed, mypy is there to! Thanks for the pointer!

At work, we are limited (for the most part) to what is included in RHEL repositories, and even more by the fact we are still on 6.9 on some projects. Hence why I mentioned python-contract, as it's not in RHEL repos (that I could find). Thankfully pyflakes/checker/lint are. I will have to check for mypy.