Elektrine lite

← Feed

@treyhunner@mastodon.social

2026-08-01 15:29 UTC

@ambv@mastodon.social I now vaguely remember seeing raise "string" years ago, but never thought about the significance of that. I did not know that this is the reason raising an exception class works!

Replies (1)

  • @mgedmin@floss.social 2026-08-01 16:09

    @treyhunner@mastodon.social @ambv@mastodon.social I seem to remember raise ValueError, x as alternative syntax for raise ValueError(x) that is you could pass a class and arguments separately, and it would construct an exception instance for you. I don't remember builtin exceptions ever being variables with string values, but I only started with Python 2.1.

    Open ##5019068