Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not() operator, to match anything but the state #22

Open
HarryR opened this issue Feb 8, 2019 · 2 comments
Open

Not() operator, to match anything but the state #22

HarryR opened this issue Feb 8, 2019 · 2 comments

Comments

@HarryR
Copy link

HarryR commented Feb 8, 2019

As titled, it would be good to have a Not operation, so you can match in anything but the specified value.

This could be combined with a OneOf operator, e.g. Not(OneOf(1, 2, 3))

@santinic
Copy link
Owner

+1 good idea

@yjqiang
Copy link

yjqiang commented Jul 18, 2019

Maybe we can make it in this way?

class Not:
    __slots__ = ('_value',)

    def __init__(self, value):
        self._value = value

    def __call__(self, value) -> bool:
        return self._value != value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants