A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

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>&gt;&gt;&gt; &quot;abc&quot;.encode(&quot;bin&quot;)<br>&quot;011000010110001001100011&quot;<br>&gt;&gt;&gt; &quot;011000010110001001100011&quot;.decode(&quot;bin&quot;)<br>&quot;abc&quot;<br>
<br>decode should also support padding, either None, &quot;left&quot;, or &quot;right&quot;, i.e.,<br>&gt;&gt;&gt; &quot;1&quot;.decode(&quot;bin&quot;) # error<br>&gt;&gt;&gt; &quot;1&quot;.decode(&quot;bin&quot;, &quot;left) # 00000001
<br>'\x01'<br>
&gt;&gt;&gt; '1'.decode(&quot;bin&quot;, &quot;right&quot;) # 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 (&quot;put this file in ../encodings&quot;)<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 &quot;you can<br>write it for yourself&quot; is true, but the same came be said about &quot;hex&quot;, which can 
<br>even be written as a one-liner: &quot;&quot;.join(&quot;%02x&quot; % (ord(ch),) for ch in &quot;abc&quot;)<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