Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.047 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'subject:into': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.11; '__slots__': 0.16; 'big,': 0.16; 'crosses': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'present;': 0.16; 'really?': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'subclass': 0.16; 'suggestion.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'header :User-Agent:1': 0.23; 'greg': 0.24; 'integer': 0.24; 'header': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'bigger': 0.30; 'consisting': 0.31; 'int,': 0.31; 'overhead': 0.31; 'probably': 0.32; 'another': 0.32; 'up.': 0.33; 'maybe': 0.34; "i'd": 0.34; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'disk': 0.36; 'instances': 0.36; 'received:com.au': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; "i'll": 0.36; 'too': 0.37; 'received:211': 0.38; 'issue': 0.38; 'space': 0.40; 'skip:o 30': 0.61; 'content-disposition:inline': 0.62; "you'll": 0.62; 'kind': 0.63; 'real': 0.63; 'total': 0.65; 'forward': 0.65; 'feeling': 0.68; 'obvious': 0.74; 'wave': 0.74; 'subject:have': 0.80; '"too': 0.84; 'back?': 0.84; 'dict,': 0.84; 'hand.': 0.84; 'high,': 0.84; 'packing': 0.84; 'slot,': 0.84; 'subject:think': 0.84 Date: Mon, 20 May 2013 16:07:51 +1000 From: Cameron Simpson To: Gregory Ewing Subject: Re: mutable ints: I think I have painted myself into a corner MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) References: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=e/de0tV/ c=1 sm=1 a=wom5GMh1gUkA:10 a=21x4_w1R3MUA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=StZfE6sK-9QA:10 a=ugM3WpLNAAAA:8 a=hYqexiBnbFlCrOtEHB8A:9 a=CjuIK1q_8ugA:10 a=ChdAjXE5lkUvdteQbhpnkQ==:117 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369030093 news.xs4all.nl 15922 [2001:888:2000:d::a6]:59668 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45587 On 20May2013 13:23, Greg Ewing wrote: | Cameron Simpson wrote: | >It's an int _subclass_ so that it is no bigger than an int. | | If you use __slots__ to eliminate the overhead of an | instance dict, you'll get an object consisting of a | header plus one reference, which is probably about the | size of an int. But you'll also need an int to put in | that slot, so the total size will be about twice that | of an int. Yeah, I was thinking I'd need to go that way. Thanks for the suggestion. | Another approach would be to subclass array.array and | give instances of it type integer and size 1. Together | with empty __slots__, it will probably be a bit bigger | than an int, but it might still be smaller than a | custom object plus an int. Really? Interesting. I thinik it crosses my "too baroque" threshold, but maybe not:-) | If all of these are still too big, you might need to | find some way of packing multiple instances into a | single array.array. Space isn't that real an issue at present; I'll keep that kind of approach in mind if it comes up. This really came up because I was feeling that the obvious object-with-boolean-attributes was terrbily wasteful for something that can be inplemented with a single int, in principle. Cheers, -- Cameron Simpson >>>How do you blip the throttle and wave? Do you blip it real high, then wave >>>before the revs drop back? >>Blip = right hand; Wave = left hand. Do both simultaneously. QED. >Doesnt this make the bike lurch forward thru the intersection? Not if the disk lock is in place... - Dean Woodward