The code out of GitHub doesn't appear to work, at least not how you'd hope it would. Couldn't follow the article from the command line without writing the code myself.
~/src/github.com/darius/mccarthy-to-bryant (master)$ python
>>> from nway_logic import *
>>> A, B = Variable('A'), Variable('B')
>>> A
A
>>> B
B
>>> const0 = Constant(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Constant' is not defined
~/src/github.com/darius/mccarthy-to-bryant (master)$ python
Python 2.7.10 (default, Jul 13 2015, 12:05:58)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from dd import *
>>> A, B = Variable('A'), Variable('B')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "dd.py", line 27, in Variable
return build_node(rank, tuple(map(Constant, range(arity))))
File "utils.py", line 7, in memoized
result = memoized._memos[args] = f(*args)
File "dd.py", line 34, in __init__
for b in branches: assert rank < b.rank
AssertionError
>>>
For the first, the README says it's logic.py and not nway_logic.py that has the article's code. (The latter is a generalization that was actually written first.) logic.py was extracted from the text, and the transcript tested against it.
I've just backported the renaming to Constant into nway_logic, and that example should work unaltered now -- thanks!
For the second, the interface to the decision diagrams does not use variables with names, as explained under 'Systematic succinctness' and demoed in make_alu_inputs() -- I aimed for the simplest code that shows the ideas. But I think you're right that bdd.Variable should've been called something different from logic.Variable.
Product of sadly declining ambitions: first for SVG toys, which I'm incompetent at; then yesterday I was looking into converting the text into an iPython notebook to provide an easier way to interact with the code, and that turned out to be too hard under the deadline. I ended up pushing the article's code into this repo shortly after the article went live.
I haven't yet tried this myself, but these classes get defined just a bit further down. You might need to move them up or something in order to get the early examples to work.