From a6f0d4f30a2f63b1286cd28bcb4cac752a86ec12 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Tue, 15 Jul 2008 16:29:34 -0600 Subject: [PATCH] Added Alex's pp function --- __init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 93dce7b..155b55a 100755 --- a/__init__.py +++ b/__init__.py @@ -110,7 +110,7 @@ def assert_in(a, *b): ## -## Binary stuff +## Binary and other base conversions ## class BitVector: @@ -206,6 +206,12 @@ def unhex(s): return [ord(i) for i in s.replace(' ', '').decode('hex')] +def pp(value, bits=16): + if type(value) == type(''): + value, _ = unpack('