[issue7701] fix output string length for binascii.b2a_uu()
Antoine Pitrou
report at bugs.python.org
Thu Jan 14 13:32:56 CET 2010
Antoine Pitrou <pitrou at free.fr> added the comment:
>>> [len(binascii.b2a_uu("x"*bin_len)) for bin_len in xrange(10)]
[2, 6, 6, 6, 10, 10, 10, 14, 14, 14]
>>> [(2+(bin_len+2)*4//3) for bin_len in xrange(10)]
[4, 6, 7, 8, 10, 11, 12, 14, 15, 16]
How is this the correct estimation? The results are different.
Try the following:
>>> [(2+(bin_len+2)//3*4) for bin_len in xrange(10)]
[2, 6, 6, 6, 10, 10, 10, 14, 14, 14]
----------
nosy: +pitrou
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7701>
_______________________________________
More information about the Python-bugs-list
mailing list