<div dir="ltr"><div>Sorry for the late reply. I would really like to see this fixed.</div>
<div> </div>
<div>&gt;&gt; Or we [...] deprecate binascii.(un)hexlify().<br>...<br>&gt;&gt; binascii is the legacy approach here, so if anything was to go, those functions would be it<br>...</div>
<p>I&#39;m not entirely convinced binascii is the legacy approach. What makes this module &quot;legacy&quot;?<br>On the contrary, I&#39;m pretty sure modularity is better than sticking all the functionality in the core.<br>
As was written in this issue: <a href="http://psf.upfronthosting.co.za/roundup/tracker/issue3532">http://psf.upfronthosting.co.za/roundup/tracker/issue3532</a><br>&quot;If you wanted to produce base-85 (say), then you can extend the functionality of bytes by providing a<br>
function that does that, whereas you can&#39;t extend the existing bytes type.&quot;<br>This example shows that &quot;hex&quot; is actually getting a special treatment by having builtin methods associated<br>with the bytes type. Why don&#39;t we add &quot;.base64&quot; methods? Or even &quot;.zlib&quot;? After all, these options were present<br>
in Python 2.x using the &quot;encode&quot; method of string. In my opinion, having modules to deal with these types of<br>conversions is better, and this is why I suggested sticking to binascii.</p>
<div>In any case, seeing as both this discussion and the one linked above were abandoned, I would like to hear<br>about what needs to be done to actually fix these issues. If no one else is willing to do it (that would be a<br>
little disappoiting), I think I have the skills to learn and fix the code itself, but I don&#39;t have the time<br>and I am unfamiliar with the process of submitting patches and getting them approved. For example, who gets<br>
to decide about the correct approach?<br>Is there a better place to discuss this?</div>
<div> </div>
<div>Thanks for the responses.<br><br>  -- Arnon</div>
<div> </div>
<div class="gmail_quote">On Sun, Sep 6, 2009 at 5:51 AM, Nick Coghlan <span dir="ltr">&lt;<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">Brett Cannon wrote:<br>&gt;&gt; To fix these issues, three changes should be applied:<br>&gt;&gt; 1. Deprecate bytes.fromhex. This fixes the following problems:<br>&gt;&gt;    #4 (go with option B and remove the function that does not allow bytes<br>
&gt;&gt; input)<br>&gt;&gt;    #2 (the binascii functions will be the only way to &quot;do it&quot;)<br>&gt;&gt;    #1 (bytes.hex should not be implemented)<br>&gt;&gt; 2. In order to keep the functionality that bytes.fromhex has over unhexlify,<br>
&gt;&gt;    the latter function should be able to handle spaces in its input (fix #3)<br>&gt;&gt; 3. binascii.hexlify should return string as its return type (fix #5)<br>&gt;<br>&gt; Or we fix bytes.fromhex(), add bytes.hex() and deprecate binascii.(un)hexlify().<br>
<br></div>binascii is the legacy approach here, so if anything was to go, those<br>functions would be it. I&#39;m not sure getting rid of them is worth the<br>hassle though (especially in 2.x).<br><br>Regarding bytes.hex(), it may be better to modify the builtin hex()<br>
function to accept bytes as an input type.<br><br>Cheers,<br>Nick.<br><font color="#888888"><br>--<br>Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>   |   Brisbane, Australia<br>---------------------------------------------------------------<br>
</font></blockquote></div><br></div>