Comments on base52 encoder/decoder ?

Bengt Richter bokr at oz.net
Wed Jan 8 19:05:11 EST 2003


On 08 Jan 2003 10:11:03 -0800, Paul Rubin <phr-n2002b at NOSPAMnightsong.com> wrote:

>bokr at oz.net (Bengt Richter) writes:
>> BTW, how about the option to insert \n after every line_len characters?
>> And if so, should there be a final \n guaranteed there or not there?
>> Or should that be left to the outside too?
>
>I'd say leave that on the outside too.

Stripping it down like that leaves a lot of code space unused. I guess the
unused codes should be rejected as I currently do for the default mode.
Maybe I'll include 'extra code space available' in the error message ;-)

>
>I've sometimes thought there should be a function for splitting a long
>string into a bunch of shorter ones of specified length, but I don't
>know if that would give a worthwhile speedup vs. the obvious list
>comprehension.

One might pass a chunk length integer to str.split, e.g.,

    s.split(n)

to get 

    [s[i:i+n] for i in xrange(0,len(s),n)]

PS. Any other votes on base52?

BTW, this isn't a language thing, so I wouldn't think it's a PEP thing, but
what is the right way to proceed to get it considered for inclusion? A patch
for binascii.c is obvious. Are the following four the whole story? Is the html
automatically generated from the .tex?

D:\Python-2.2.2\Doc\lib\libbinascii.tex
D:\Python-2.2.2\Lib\test\test_binascii.py
D:\Python-2.2.2\Lib\test\output\test_binascii
D:\Python-2.2.2\Modules\binascii.c

D:\Python22\Doc\lib\module-binascii.html
D:\Python22\Lib\test\test_binascii.py
D:\Python22\Lib\test\output\test_binascii

The last two are just duplicates of the source distribution AFAICS.

Regards,
Bengt Richter




More information about the Python-list mailing list