You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: from spinoff.util.pattern_matching import ANY
In [2]: ANY == set([])
Out[2]: True
In [3]: ANY == set([1, 2, 3])
Out[3]: True
In [4]: ('test', ANY) == ('test', set([1, 2, 3]))
Out[4]: True
In [5]: ('test', set([1, 2, 3])) == ('test', ANY)
Out[5]: False
In [6]: set([1, 2, 3]) == ANY
Out[6]: False
The reason is that it is Python who decides which operand's __eq__ method gets invoked.
I think the proper solution for this is not to rely on ==—using == could be considered unpythonic anyway. Metacontext however could solve this easily—talking of which, I still haven't had time to look into it...
I should definitely address this issue before Spinoff 1.0.
It appears that sets are not correctly matched by ANY:
This test prints out "unhandled msg, ('test', set([1,2,3]))"
The text was updated successfully, but these errors were encountered: