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


Groups > comp.lang.python > #38509

Re: python3 binascii.hexlify ...

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '"""': 0.05; 'binary': 0.05; 'subject:skip:b 10': 0.07; '"""return': 0.09; 'bytes,': 0.09; 'docs.': 0.09; 'received:209.85.212.54': 0.09; 'producing': 0.15; 'sat,': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hex': 0.16; 'hexadecimal': 0.16; 'str),': 0.16; 'subject:python3': 0.16; 'wrote:': 0.17; 'byte': 0.17; 'bytes': 0.17; 'instance,': 0.17; 'feb': 0.19; 'converted': 0.22; 'header :In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'received:209.85.212': 0.28; 'str': 0.29; 'though.': 0.29; 'function': 0.30; 'sense': 0.31; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'clear': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'data.': 0.36; 'should': 0.36; 'operating': 0.36; 'two': 0.37; '(for': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'necessarily': 0.63; 'subject:...': 0.63; 'taking': 0.65; '2013': 0.84; 'otten': 0.84; 'subject: ...': 0.84; 'str.': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=u7Ozu5/1XI61xQs0qqFKNYcb//QuIkxPKXSV9AC/ygU=; b=i8kXci8ezyRs55qchIP8vUkKeMElyBaSH61cA/BKYffiF0J7E5NWMtMtmFpQ9uNXJv j1upF61RpKMZjE+jzgpeV/SHDAlF/bnR05831c+U86z95es61WrSTM/Qe9AlXYDTDY4r WqSk/6/5t5+6ZYhc3DdSEn52bIjnQ/bZ+lnMjHQJBNWzPp0g3hDyDQmhsvurrWalUWeo 9Grvn+LWVj3cRveNJuTVZ4uQkrjn9ENyilcSpoC7JjvzPpKy4S4qM94XibIcPS9vycUd kNE/JMryXAppEqi0hB9e24UGDrKRgq6Mk8n8pG0kn3fhaCw2qm3YdDxOMZgTjYhga36W EgvQ==
MIME-Version 1.0
X-Received by 10.52.29.109 with SMTP id j13mr9392784vdh.111.1360409185941; Sat, 09 Feb 2013 03:26:25 -0800 (PST)
In-Reply-To <kf5aqq$etq$1@ger.gmane.org>
References <20130209104433.GA13443@cskk.homeip.net> <kf5aqq$etq$1@ger.gmane.org>
Date Sat, 9 Feb 2013 22:26:25 +1100
Subject Re: python3 binascii.hexlify ...
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1540.1360409195.2939.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360409195 news.xs4all.nl 6881 [2001:888:2000:d::a6]:38422
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38509

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web