[Python-ideas] Predicate Sets

Devin Jeanpierre jeanpierreda at gmail.com
Mon Jan 20 02:17:04 CET 2014


On Sun, Jan 19, 2014 at 3:41 PM, Daniel da Silva
<var.mail.daniel at gmail.com> wrote:
> Below is a description of a very simple but immensely useful class called a
> "predicate set". In combination with the set and list comprehensions they
> would allow another natural layer of reasoning with mathematical set logic
> in Python.

Efficiently implementing the set operators (intersection, union, etc.)
requires using ROBDDs (reduced ordered binary decision diagrams),
which are complex enough to deserve their _own_ library. It's not a
simple task, and shouldn't be written from scratch.

That said, if you implemented it, and did it efficiently, I'd find it
hugely helpful. I ended up implementing it on my own in a bit of a
brute force fashion once (I used truth tables instead of BDDs):
https://bitbucket.org/devin.jeanpierre/replay/src/4ca3e412e511a9af87c335303c9ab40848be99c0/replay/sets.py?at=default
(I make no claims to this being good or correct code)

-- Devin


More information about the Python-ideas mailing list