Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38509 > unrolled thread

Re: python3 binascii.hexlify ...

Started byChris Angelico <rosuav@gmail.com>
First post2013-02-09 22:26 +1100
Last post2013-02-09 22:26 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python3 binascii.hexlify ... Chris Angelico <rosuav@gmail.com> - 2013-02-09 22:26 +1100

#38509 — Re: python3 binascii.hexlify ...

FromChris Angelico <rosuav@gmail.com>
Date2013-02-09 22:26 +1100
SubjectRe: python3 binascii.hexlify ...
Message-ID<mailman.1540.1360409195.2939.python-list@python.org>
On Sat, Feb 9, 2013 at 10:10 PM, Peter Otten <__peter__@web.de> wrote:
> """Return the hexadecimal representation of the binary data. Every byte of
> data is converted into the corresponding 2-digit hex representation.
> """
>
> makes it pretty clear that the function is operating on bytes, not str.

That doesn't necessarily mean it has to return bytes, though. It's
taking binary data and producing something that's plausibly either
bytes or str. It's human-readable and would definitely make sense to
be str (for instance, hex() returns a str), so imo this should be made
very clear in the docs. Maybe:

"""Return the hexadecimal representation of the binary data. Every byte of
data is converted into two bytes with the corresponding hex
representation in ASCII.
"""

or somesuch?

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web