dabeaz,
@dabeaz@mastodon.social avatar

A bit disappointed...

>>> exc = ValueError("Bad Value")
>>> match exc:
... case ValueError(msg):
... print("Failed:", msg)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: ValueError() accepts 0 positional sub-patterns (1 given)
>>>

tmr232,
@tmr232@mastodon.social avatar

@dabeaz Mostly disappointed that I can't think of a way to properly hack around this. The match semantics are very limiting.

drj,
@drj@typo.social avatar

@dabeaz haha. Because why would "except:", the pre-existing system for matching instances, match "match:", the new system for matching instances written by language dilettantes.

dabeaz,
@dabeaz@mastodon.social avatar

@drj It's like the cybertruck of matching.

emattiza,
@emattiza@hachyderm.io avatar

@dabeaz exc.args is right there too. Just a juicy match_args def on Exception away...

dabeaz,
@dabeaz@mastodon.social avatar

@emattiza Meh. Sounds hacky.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • mdbf
  • DreamBathrooms
  • cisconetworking
  • magazineikmin
  • InstantRegret
  • everett
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • khanakhh
  • Durango
  • kavyap
  • ethstaker
  • megavids
  • anitta
  • modclub
  • osvaldo12
  • normalnudes
  • ngwrru68w68
  • GTA5RPClips
  • tacticalgear
  • provamag3
  • tester
  • Leos
  • cubers
  • JUstTest
  • lostlight
  • All magazines