Talin

Results 296 comments of Talin

One of the early arguments for the (deferred) custom matcher feature was to be able to have matchers of the form `equals(x)` or `isExactly(x)`, which I think reads more intuitively...

Another example: a 2D spatial matcher. ```py @dataclass class Point: x: int y: int class InCircle: @staticmethod def __match__(target, center, radius): # Note use of nested match statement and guard...

A few more examples: ```py class EqualTo: """Matcher class that matches values by equality.""" @staticmethod def __match__(target, expected): return target if target == expected else None match x: # Value...

> Before derailing this issue, would you be interested in collecting other alternatives here, or did you wrote this to discuss over the alternative you put in the description? Sure,...

A few more notes on this. A custom matcher invocation has the following lifecycle: * pre-match parameter evaluation * invoke the `__match__` method: * 'the test' - determine whether the...

I read it a while back, but forgot the details. I just re-read it. Ivan's proposed match protocol is quite a bit different than what I outline here. The basic...

Thanks @dmoisset for a detailed and thoughtful response. There are two issues I am concerned about. I did actually consider using a callable instead of a type. However, in Python...

Thanks @dmoisset , I believe I understand what you are saying now, and in general I have no problem with it. However, I want to shift gears for a moment...

I want to bring up one subtle point that I think has been overlooked: If we do define a prefix operator for named pattern variables, this _does not affect the...

I created an experimental branch https://github.com/gvanrossum/patma/blob/expr-qmark/examples/expr.py showing what my `expr.py` example would look like with named variables explicitly declared with a prefix character. My reaction is: PRO: It is very...