3 ms·
This is a tragedy, as it forces comments to contain syntactic value.
by dimino 11y ago
This is a tragedy, as it forces comments to contain syntactic value.
- deckiedan 11y agoNot quite. The PEP is (to me) quite explicit that the typing is never mandatory. So a comment-hint will never change the way the code actually runs, nor will lack of a comment or an unintentional comment cause a program to act strangely. Already, anyone seriously using pylint or other "normal" python linting tools uses comments like that to give extra hints to the linter: def blah(): # pylint: ignoresomething type of thing. Yes, it's a bit weird, and yes, it does teeter right on the edge of the comments as syntactic value precipice, but I think lands just on the alright side.
- ta0967 11y agothe `type: x` comments substitute explicit syntax in places where i'd want type inference, so it's no big deal.