Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38538
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; '"""': 0.05; 'binary': 0.05; 'bytes.': 0.07; 'chunk': 0.07; 'dependency': 0.07; 'reason,': 0.07; 'subject:skip:b 10': 0.07; '"""return': 0.09; 'bytes,': 0.09; 'docs.': 0.09; 'cc:addr:python-list': 0.10; 'producing': 0.15; 'sat,': 0.15; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'hex': 0.16; 'hexadecimal': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'newsgroups': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'str),': 0.16; 'subject:python3': 0.16; 'textual': 0.16; 'string': 0.17; 'wrote:': 0.17; 'fix': 0.17; 'byte': 0.17; 'bytes': 0.17; 'instance,': 0.17; 'feb': 0.19; 'do.': 0.21; 'converted': 0.22; 'doc': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'chris': 0.28; 'str': 0.29; 'though.': 0.29; 'maybe': 0.29; 'function': 0.30; 'sense': 0.31; 'clear': 0.35; 'returning': 0.35; 'pm,': 0.35; 'something': 0.35; 'but': 0.36; 'data.': 0.36; 'received:au': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'operating': 0.36; 'two': 0.37; '(for': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'content- disposition:inline': 0.60; 'course.': 0.62; 'between': 0.63; 'necessarily': 0.63; 'subject:...': 0.63; 'natural': 0.65; 'taking': 0.65; 'special': 0.73; '2013': 0.84; '_if_': 0.84; 'otten': 0.84; 'subject: ...': 0.84; 'str.': 0.91 |
| Date | Sun, 10 Feb 2013 07:32:20 +1100 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | Chris Angelico <rosuav@gmail.com> |
| Subject | Re: python3 binascii.hexlify ... |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <CAPTjJmp2jeFSPij=gTP_wtxug+sra-Mnfcz9NkCEn7sTGHQ2Kg@mail.gmail.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <CAPTjJmp2jeFSPij=gTP_wtxug+sra-Mnfcz9NkCEn7sTGHQ2Kg@mail.gmail.com> |
| Cc | python-list@python.org |
| 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.1562.1360441945.2939.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1360441945 news.xs4all.nl 6853 [2001:888:2000:d::a6]:57695 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:38538 |
Show key headers only | View raw
On 09Feb2013 22:26, Chris Angelico <rosuav@gmail.com> wrote: | 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. Well of course. I want a hexadecimal string representation of a chunk of bytes. It should be producing a string. | 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? Only if returning a string would break something relying on hexlify returning bytes. The natural way to write this function is to have it return a string. _If_ there's some dependency in the stdlib, maybe a doc fix would do. But otherwise IMO the function should be returning a string. What is the use case for returning bytes that just _look_ like a string? It is returning a textual representation; without a good reason, that should be a string. -- Cameron Simpson <cs@zip.com.au> Because of its special customs, crossposting between alt.peeves and normal newsgroups is discouraged. - Cameron Spitzer
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: python3 binascii.hexlify ... Cameron Simpson <cs@zip.com.au> - 2013-02-10 07:32 +1100
csiph-web