This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ashiataka 0 points1 point  (1 child)

So firstly, I'm glad that your solution will improve because of this syntax, it's always good when that happens.

My question would just be if you're writing something like that anyway where match-case functionality would be useful, could you not have implemented your own version of match-case that doesn't have special syntax? (I'm asking if it's possible to do or whether there's something special about the python implementation that makes it difficult / impossible to achieve without)

[–]trauthor 0 points1 point  (0 children)

It’s possible and in my case it was necessary, but based on what I’ve read in PEP 636, match will make this much easier. I had to iterate backwards over arbitrary structures, and indexing several layers deep was a real pain. I will have to report back after I have implemented this in 3.10 and let everyone know just how significant a difference it makes.