3 ms·
Shouldn't unhex() just be int(s, 16)? Not sure what it adds, but I don't quite understand it yet and perhaps there's something magic in the context of MIME quo
by unwind 12y ago
Shouldn't unhex() just be int(s, 16)?
Not sure what it adds, but I don't quite understand it yet and perhaps there's something magic in the context of MIME quoted printable that I'm missing.
- dalke 12y agoThat is an excellent point! Based on my reading, there's nothing magic. The context is: elif i+2 < n and ishex(line[i+1:i+2]) and ishex(line[i+2:i+3]): new = new + bytes((unhex(line[i+1:i+3]),)); i = i+3 I tweaked it to new = new + bytes((int(line[i+1:i+3], 16),)); i = i+3 and the self-tests still pass. (I also changed the 16 to 15 to double-check that the tests were actually exercising that code.) It's not part of the public API, so it looks like it can simply be removed. Do you want to file the bug report? Or perhaps it's best to update http://bugs.python.org/issue21869 http://bugs.python.org/issue21869 ("Clean up quopri, correct method names encodestring and decodestring")?
- yoha 12y ago> It's not part of the public API, so it looks like it can simply be removed. https://docs.python.org/3/library/functions.html#int https://docs.python.org/3/library/functions.html#int So that is actually standard. Maybe I just don't know what you mean by public API though.