I believe raises is the de facto Python version of throws, but no tools seem to exist to actually handle it.

Eager Eagle
link
fedilink
English
26M

that’s still a docstring, idk of linters that take docstrings into account at all. We need a semantic approach for this kind of annotation.

That’s way harder to ask for. A docstring solution is fine so long as the linters know to pick it up.

Eager Eagle
link
fedilink
English
1
edit-2
6M

I don’t think so. A half-measure using docstrings would likely take more processing power and require an ad-hoc implementation because comments are not broken down into ast components afaik. It would also be more costly in the long run if they decide to convert it into a proper syntax, as a result of docstrings not having a single standard way of being written.

Python has introduced several syntactic changes for type annotations, this is not unreasonable.

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 77 users / day
  • 211 users / week
  • 413 users / month
  • 2.92K users / 6 months
  • 1 subscriber
  • 1.53K Posts
  • 33.8K Comments
  • Modlog