Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6409
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| 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; 'subject:: [': 0.03; '2.x': 0.05; 'api.': 0.05; 'predefined': 0.05; 'subject:Python': 0.06; 'formatting': 0.07; 'pep': 0.07; 'from:addr:python': 0.09; 'interpreter.': 0.09; 'text?': 0.09; 'pm,': 0.10; '>>>': 0.12; 'wrote:': 0.14; '8-bit': 0.16; 'articulate': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'methods,': 0.16; 'nick': 0.16; 'otoh,': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr:python-list': 0.16; 'sequence.': 0.16; 'str.format()': 0.16; "would've": 0.16; 'converting': 0.16; "subject:' ": 0.16; 'subject:] ': 0.16; "wouldn't": 0.17; '27,': 0.19; 'bytes': 0.19; 'have:': 0.19; 'convert': 0.19; 'header:In-Reply-To:1': 0.21; "aren't": 0.22; 'trying': 0.23; 'fri,': 0.23; '(or': 0.24; "doesn't": 0.25; 'byte': 0.25; 'certainly': 0.25; 'received:84': 0.25; 'saying': 0.26; 'string': 0.26; 'object': 0.26; 'all,': 0.30; 'confusion': 0.30; 'strings.': 0.30; 'clearly': 0.32; 'cases': 0.32; 'proposed': 0.32; 'does': 0.33; 'to:addr:python-list': 0.33; "isn't": 0.33; 'it?': 0.33; 'rather': 0.34; 'however,': 0.34; 'header:User-Agent:1': 0.35; 'defining': 0.35; 'reply- to:addr:python.org': 0.35; 'sense,': 0.35; 'similar': 0.37; 'stephen': 0.37; 'could': 0.38; 'anything': 0.38; 'but': 0.38; 'component': 0.38; "i'd": 0.39; 'add': 0.39; 'to:addr:python.org': 0.39; 'feature': 0.40; 'addition': 0.60; 'almost': 0.60; 'simply': 0.60; 'address': 0.62; 'harder': 0.65; 'making': 0.67; 'alternative': 0.71; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; '"oh,': 0.84; 'based,': 0.84; 'parts,': 0.84 |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | AlEGAIzO301UXebj/2dsb2JhbABUmC2ODneIcL0dhh4ElH6DAYda |
| Date | Fri, 27 May 2011 17:21:50 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: [Python-ideas] Adding 'bytes' as alias for 'latin_1' codec. |
| References | <BANLkTin1P5BVUisF-SfW=-TUeQbumDdBvA@mail.gmail.com> <irkc54$gih$1@dough.gmane.org> <irl5n7$l1q$1@dough.gmane.org> <BANLkTikQXPJ3Y0SBfG5UKhu1S-CVDo5sng@mail.gmail.com> <DF3948D2-C0AC-4B6E-A722-25004C48C0E2@masklinn.net> <irmk2f$ess$1@dough.gmane.org> <BANLkTikTnwrGA2N2oaxwNsqYDVeWO6CXVQ@mail.gmail.com> <BANLkTinsqOGZzU7DXBShde9N1kudoSFP8Q@mail.gmail.com> <87k4dc8r9j.fsf@uwakimon.sk.tsukuba.ac.jp> <BANLkTi=m6QkP0xSwBeYXE+Np=ZN7MsAcrQ@mail.gmail.com> |
| In-Reply-To | <BANLkTi=m6QkP0xSwBeYXE+Np=ZN7MsAcrQ@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.2152.1306513320.9059.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1306513321 news.xs4all.nl 49183 [::ffff:82.94.164.166]:60417 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6409 |
Show key headers only | View raw
On 27/05/2011 10:27, Nick Coghlan wrote:
> On Fri, May 27, 2011 at 6:46 PM, Stephen J. Turnbull<stephen@xemacs.org> wrote:
>> > What method is invoked to convert the numbers to text? What encoding
>> > is used to convert those numbers to text? How does this operation
>> > avoid also converting the *bytes* object to text and then reencoding
>> > it?
>>
>> OTOH, Nick, aren't you making this harder than it needs to be? After
>> all,
>
> To me, the defining feature of str.format() over str.__mod__() is the
> ability for types to provide their own __format__ methods, rather than
> being limited to a predefined set of types known to the interpreter.
> If bytes were to reuse the same name, then I'd want to see similar
> flexibility.
>
> Now, a *different* bytes method (bytes.interpolate, perhaps?), limited
> to specific types may make sense, but such an alternative *shouldn't*
> be conflated with the text formatting API.
>
> However, proponents of such an addition need to clearly articulate
> their use cases and proposed solution in a PEP to make it clear that
> they aren't merely trying to perpetuate the bytes/text confusion that
> plagues 2.x 8-bit strings.
>
> We can almost certainly do better when it comes to constructing byte
> sequences from component parts, but simply saying "oh, just add a
> format() method to bytes objects" doesn't cut it, since the associated
> magic methods for str.format are all string based, and bytes
> interpolation also needs to address encoding issues for anything that
> isn't already a byte sequence.
>
I would've thought that a "format" (or equivalent) method for bytes
would work like struct.pack, so b"{0}".format(23) wouldn't return
b'23', but you could have:
>>> b'{0:b}'.format(23)
b'\x17'
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [Python-ideas] Adding 'bytes' as alias for 'latin_1' codec. MRAB <python@mrabarnett.plus.com> - 2011-05-27 17:21 +0100
csiph-web