Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5707
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ethan@stoneleaf.us> |
| 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; 'way:': 0.05; 'subject:Python': 0.06; 'constructor': 0.07; 'bytearray': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'kelly': 0.09; 'message- id:@stoneleaf.us': 0.09; 'object.': 0.09; 'received:gator410.hostgator.com': 0.09; 'size)': 0.09; '~ethan~': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'furman': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'tue,': 0.17; 'bytes': 0.19; 'header:In-Reply-To:1': 0.21; 'null': 0.23; 'way?': 0.23; 'skip:b 20': 0.23; 'to:addr:python-list': 0.33; 'however,': 0.34; 'header :User-Agent:1': 0.35; '17,': 0.35; 'question,': 0.38; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:websitewelcome.com': 0.67; 'dealing': 0.69 |
| Date | Wed, 18 May 2011 09:40:40 -0700 |
| From | Ethan Furman <ethan@stoneleaf.us> |
| User-Agent | Thunderbird 1.5.0.10 (Windows/20070221) |
| MIME-Version | 1.0 |
| To | Python <python-list@python.org> |
| Subject | Re: Python 3.x and bytes |
| References | <4DD2C2A5.3080403@stoneleaf.us> <BANLkTimvzZeN5dmm2xHP5xV8Kpw2Nb9kuQ@mail.gmail.com> <4DD2D89D.4000303@stoneleaf.us> <BANLkTintqgBLFtBx8+1b+R10nywuKdKHOw@mail.gmail.com> |
| In-Reply-To | <BANLkTintqgBLFtBx8+1b+R10nywuKdKHOw@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - gator410.hostgator.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - stoneleaf.us |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| X-Source-Sender | mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:4657 |
| X-Source-Auth | ethan+stoneleaf.us |
| X-Email-Count | 1 |
| X-Source-Cap | dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.1756.1305736108.9059.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1305736108 news.xs4all.nl 49041 [::ffff:82.94.164.166]:37888 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:5707 |
Show key headers only | View raw
Ian Kelly wrote: > On Tue, May 17, 2011 at 2:20 PM, Ethan Furman <ethan@stoneleaf.us> wrote: >> The big question, though, is would you do it this way: >> >> some_var = bytes(23).replace(b'\x00', b'a') >> >> or this way? >> >> some_var = bytes(b'a' * 23) > > Actually, I would just do it this way: > > some_var = b'a' * 23 > > That's already a bytes object. Passing it into the constructor is redundant. However, as I just discovered, it works well when dealing with a bytearray object: some_var = bytearray(b' ' * size) # want space initialized, not null ~Ethan~
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python 3.x and bytes Ethan Furman <ethan@stoneleaf.us> - 2011-05-18 09:40 -0700
csiph-web