Showing content from http://mail.python.org/pipermail/python-dev/attachments/20060421/5772205f/attachment.htm below:
yeah, i came to realize nothing helpful will ever come out from this list, so i might <br>as well stop trying. but i have one last thing to try.<br><br>i'm really missing a binary codec, just like the hex codec, for doing things like
<br>>>> "abc".encode("bin")<br>"011000010110001001100011"<br>>>> "011000010110001001100011".decode("bin")<br>"abc"<br>
<br>decode should also support padding, either None, "left", or "right", i.e.,<br>>>> "1".decode("bin") # error<br>>>> "1".decode("bin", "left) # 00000001
<br>'\x01'<br>
>>> '1'.decode("bin", "right") # 10000000<br>
'\x80'<br>
<br>i've written a codec by myself for that, it's not that complicated, but the problem<br>is, because it's not in the standard encodings package, i can't distribute code that<br>uses it easily:<br>* i have to distribute it with every release, or i'll enter a dependency nightmare.
<br>* i'd have to provide setup instructions for the codec ("put this file in ../encodings")<br>and rely on user's abilities. it's not that i think my users are incapable of doing so,<br>but my distro shouldn't rely on my users.
<br>* upgrading more complicated (need to fix several locations)<br>* i don't want to write intrusive setups. i like to keep my releases as simple as zip <br>files that the user just needs to extract to /site-packages, with no configuration or
<br>setup hassle. setups are too dangerous imho, you can't tell they if they'd mess up<br>your configuration.<br><br>so i resorted to an encode_bin and decode_bin functions that are included with my <br>code. of course this codec should be written in c to make it faster, as it's quite a
<br>bottleneck in my code currently.<br><br>it's a trivial and useful codec that should be included in the stdlib. saying "you can<br>write it for yourself" is true, but the same came be said about "hex", which can
<br>even be written as a one-liner: "".join("%02x" % (ord(ch),) for ch in "abc")<br><br>so now that it's said, feel free to (-1) it by the millions. don't worry, i will not waste <br>my or your time anymore.
<br><br><br>-tomer
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4