Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31948
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'mrab': 0.05; 'chunk': 0.07; 'subject:help': 0.07; '22,': 0.09; 'fetch': 0.09; 'slightly': 0.15; '9:13': 0.16; 'chunk)': 0.16; 'chunk:': 0.16; 'oct': 0.16; 'read:': 0.16; 'travis': 0.16; 'true:': 0.16; 'wrote:': 0.17; 'thanks,': 0.18; 'least': 0.25; 'header:In-Reply- To:1': 0.25; 'appreciated.': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'signatures': 0.29; 'received:209.85.215.46': 0.30; 'could': 0.32; 'skip:l 40': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'optimization': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'between': 0.63; 'different': 0.63; 'great': 0.64; 'gap': 0.84; 'localized': 0.84; 'to:name:python': 0.84; 'ideas.': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=wvlz4mHbyIdFZldlA5Rxnhfq3WSFa6P8Eq0xcDPpBHM=; b=sLV+4he3m/mFFa7Y3oJmFFhNyy4g8ULlSrGtmt8RV6TA6jOtbmL7xhdIj+Qi7vNmPu tuWsBjPDjJ2ewIPNiBAliz/7FkNwG2Xx4loA6OZgaRGXo05SJjA1rXEJS+nutkjemfM1 EBiUT40c2/9rDgqgRjbDFa7Nsh/ZeXRJbkWBg+mlxaxniJvNtSNonWLqdBy7hLIP7OZE XtG93KsrsqCg3I4mjvgArBX9kCwtOx/aOOtSmiU7aHCqx2lYYPsy+50zIS75reWqEmkc o0POeBhR0dfX+RahKp8+V1e4igpxVfDEpyumwVnXVx2uduU5PQW8ReotrbrV3a3i53DI W8KA== |
| MIME-Version | 1.0 |
| In-Reply-To | <409B8DCE-2A8A-4B3D-B760-016A0EAB1FC3@gmail.com> |
| References | <168DF25C-0C43-45F2-BEDC-17AC4210F207@gmail.com> <5085F3DA.1010809@mrabarnett.plus.com> <409B8DCE-2A8A-4B3D-B760-016A0EAB1FC3@gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 23 Oct 2012 11:46:37 -0600 |
| Subject | Re: Style help for a Smalltalk-hack |
| To | Python <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.2680.1351014449.27098.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351014449 news.xs4all.nl 6938 [2001:888:2000:d::a6]:44015 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31948 |
Show key headers only | View raw
On Tue, Oct 23, 2012 at 9:13 AM, Travis Griggs <travisgriggs@gmail.com> wrote:
>
> On Oct 22, 2012, at 6:33 PM, MRAB <python@mrabarnett.plus.com> wrote:
>
>> Another way you could do it is:
>>
>> while True:
>> chunk = byteStream.read(4)
>> if not chunk:
>> break
>> ...
>>
>> And you could fetch multiple signatures in one read:
>>
>> signatures = list(struct.unpack('>{}I'.format(valveCount), byteStream.read(4 * valueCount)))
>
> Thanks, both great ideas. Still does the read/decode slightly different between the different sites, but at least it's localized better. Much appreciated.
Another small optimization would be to read the gap and the valveCount together:
chunk = byteStream.read(8)
...
gap, valveCount = struct.unpack('>2l', chunk)
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Style help for a Smalltalk-hack Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-23 11:46 -0600
csiph-web