Re:Practical Python Programming
by scubbo on Thursday June 18, 2020 @08:01PM
(#23569535)
It's super-easy to use! More flexible than Java, but (so far as I can tell) just as powerful in terms of catching errors.
[ Parent
| on HN ]
Re:Practical Python Programming
by willcipriano on Thursday June 18, 2020 @08:09PM
(#23569582)
You can even benefit from it without bothering with the type annotations (though they make it more effective).
Re:Practical Python Programming
by ed25519FUUU on Thursday June 18, 2020 @08:09PM
(#23569584)
Maybe your IDE experience is different than mine, but a typed function will gladly accepted an untyped var without complaining, and during runtime could care less.
Re:Practical Python Programming
by ghostwriter on Friday June 19, 2020 @07:21AM
(#23573250)
> but a typed function will gladly accepted an untyped var without complaining
this can be made prohibited by MyPy's --strict flag [1], and enforced with a mypy git pre-commit hook locally, and with a MyPy CI job.
[1] https://mypy.readthedocs.io/en/stable/command_line.html#cmdo...
That's a mypy setting
Re:Practical Python Programming
by anentropic on Friday June 19, 2020 @06:31AM
(#23573028)
There is type inference in all of the Python type checkers, it's not necessarily an "untyped" var because it lacks an annotation.
Running a type checker in Python is a way to avoid runtime type errors, just like in compiled languages, but without a performance benefit.