Hacker News new | past | comments | ask | show | jobs | submit login

If you want it today, Pampy does most of it:

https://github.com/santinic/pampy

Even match on Point(x, y, _)




There is also switchlang¹ which isn't quite the same thing, but provides some of the functionality of PEP-622 and pampy. I believe it is notable for including a nice descriptive README, and also having a small/simple implementation.

I personally prefer the pampy internals, but quite like the context manager usage from switchlang. I don't even know which bikeshed I want to paint, let alone the colour.

1. https://github.com/mikeckennedy/python-switch


How did they implement Point(x, y, _) matching? PEP proposes a special protocol [1] based on __match__ classmethod. Do they do something similar?

[1] https://www.python.org/dev/peps/pep-0622/#runtime


Wow, that's way cooler than the PEP! "You can write a Lisp calculator in 5 lines" Oh my!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: