Working with raw binary digits.

Steven Taschuk staschuk at telusplanet.net
Thu Feb 27 13:18:01 EST 2003


Quoth Jorge Godoy:
> Are there modules to work with raw binary digits? I don't want to work
> with hexadecimal digits, but with binary digits. My intention is
> simulating some algorithms before implementing it using the necessary
> gates (AND, OR, NAND, NOR, etc. ICs). 

If you want to use individual bits, just use 0 and 1, and the
logical operators 'and', 'or', and 'not'.  Roll your own nand,
nor, etc., in terms of these.

If you want to apply such operators to bit strings, use the
bitwise operators &, | and ~.  Roll your own nand, nor, etc., in
terms of these.

If you want to simulate hardware, that might be a different story.

Am I missing something?

-- 
Steven Taschuk                                                   w_w
staschuk at telusplanet.net                                      ,-= U
                                                               1 1





More information about the Python-list mailing list