Skip to content

Instantly share code, notes, and snippets.

@imankulov
Created February 23, 2017 19:13
Show Gist options
  • Save imankulov/1ea14fb895f5eacdae968683ea219075 to your computer and use it in GitHub Desktop.
Save imankulov/1ea14fb895f5eacdae968683ea219075 to your computer and use it in GitHub Desktop.
Workaround for broken "foo AND NOT bar" logic in bitmapist
>>> bitmapist.mark_unique('foo', 1)
>>> bitmapist.mark_unique('foo', 1000)
>>> bitmapist.mark_unique('bar', 1)
>>> list(bitmapist.UniqueEvents('foo') & ~bitmapist.UniqueEvents('bar'))
[]
>>> list(bitmapist.UniqueEvents('foo') ^ bitmapist.UniqueEvents('bar') & bitmapist.UniqueEvents('foo'))
[1000]
@imankulov
Copy link
Author

Expressions of type a AND NOT b don't work as expected in bitmapist, because b may not be of the same size as a. The thing is, a AND NOT b is an equivalent for a XOR b AND a which works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment