Created
June 26, 2012 10:10
-
-
Save mkmik/2994821 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index e227f9f..d24acc5 100644 | |
--- a/patternmatching/__init__.py | |
+++ b/patternmatching/__init__.py | |
@@ -8,7 +8,8 @@ class _Values(list): | |
def match(pattern, data, flatten=True): | |
def _match(pattern, data, success): | |
def _is_ignore(pattern): | |
- return not (isinstance(pattern, _Matcher) and not pattern.ignore) | |
+ #return isinstance(pattern, IGNORE) | |
+ return False | |
is_tuple = isinstance(pattern, tuple) | |
if not is_tuple: | |
@@ -52,8 +53,6 @@ class _Marker(object): | |
class _Matcher(_Marker): | |
- ignore = False | |
- | |
def __req__(self, x): | |
return self.__eq__(x) | |
@@ -66,14 +65,12 @@ class _Any(_Matcher): | |
ANY = _Any() | |
-def IGNORE(x): | |
- if isinstance(x, _Matcher): | |
- x = x.clone() | |
- x.ignore = True | |
- return x | |
- | |
+class IGNORE(_Matcher): | |
+ def __init__(self, _): | |
+ pass | |
-IGNORE.__eq__ = lambda _: True | |
+ def __eq__(self, _): | |
+ return True | |
class IS_INSTANCE(_Matcher): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment