binascii generalization
20 Jul
2021
20 Jul
'21
7:09 a.m.
I see that the binascii module has several {a2b,b2a}_xyz functions for several flavors of ascii <-> binary conversions. But it misses a general base function set parameterized with a radix. It would be nice to add a generic set of {a2b|b2a}(s, radix=r, case={'u','l'}), where radix is a power of 2 < 36 (2, 4, 8, 16 or 32) and case is only significant for b2a, to cover all trivial ascii <-> binary conversions using an efficient native implementation. Most {a2b,b2a}_xyz can just call the generic {a2b|b2a} with the appropriate radix. 'radix' could also be called 'base' for consistency with the int() functions. I was actually surprised that it wasn't the case already...
1148
Age (days ago)
1148
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ronald Hoogenboom