Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.073 X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; 'cpython': 0.05; 'true,': 0.05; 'attribute': 0.07; 'pypy': 0.07; 'attributes': 0.09; 'python': 0.11; 'mostly': 0.14; '23,': 0.16; 'pypy.': 0.16; 'simpson': 0.16; 'subject:object': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'memory': 0.22; 'header:User-Agent:1': 0.23; 'cheers,': 0.24; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'fixed': 0.29; 'url:python': 0.33; 'used,': 0.33; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '+0200,': 0.36; 'object,': 0.36; 'var': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'access,': 0.60; 'increased': 0.61; 'url:3': 0.61; 'received:173': 0.61; 'back': 0.62; 'save': 0.62; 'content- disposition:inline': 0.62; "you'll": 0.62; 'url:blogspot': 0.65; 'url:11': 0.68; 'price': 0.69; 'analysis': 0.75; 'footprint': 0.84; 'or...': 0.84; 'phil': 0.84; 'balances': 0.93; 'url:fr': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Qs9Nqj1BaTUqGcf6tcK4yjj06/MY6/QZPNIDgrnxYM8=; b=uwTX83+v5F7IL2b0it6aC07s0UxIaEGrj7fuin9CkOFgYXUvkQsN0chYNmhnl/hunZ uJaECzEBQoIxzecMvxv9wYA/zfA5Huacwmwxjko/XFd0aPnbvdSgSJH1AxgPxYVJudMV +SHTQrtYELhRlP7TX/WBohvNP6dN2U2GmMs/eQSas0Yw032nlkt6eE+es7WSTP5Ex9uV Luj0Z+lPzWGt44OeYPDAGopfUm0K1MVKjtTtqR+F+Qnxc1TG7SNm3hkhS/nW1bl25ZCS 7wTNbkP76GEtiJK6QIFU+q+6DjgkbaBB92Q8KCiwAR62O4jCLBSun1L5bvLYxOIRlOkJ MzZw== X-Received: by 10.194.91.175 with SMTP id cf15mr2428573wjb.5.1398261578050; Wed, 23 Apr 2014 06:59:38 -0700 (PDT) Date: Wed, 23 Apr 2014 14:59:35 +0100 From: Phil Connell To: python-list@python.org Subject: Re: object().__dict__ References: <51d9b7f1-3511-4110-adb2-aa2226bd7a3c@lists.xtsubasa.org> <20140423061123.GA47008@cskk.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398261579 news.xs4all.nl 2834 [2001:888:2000:d::a6]:59432 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70543 On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > Look up the "__slots__" dunder var in the Python doco index: > > > > https://docs.python.org/3/glossary.html#term-slots > > > > You'll see it as a (rarely used, mostly discouraged) way to force a fixed > > set of attributes onto a class. As with object, this brings a smaller > > memory footprint and faster attribute access, but the price is flexibility. > > > > True, still can be the only way to save few MB or... GB without falling > back to C or PyPy. > > Have a look at PyPy to how to save memory (and speed things up) without > slots: > http://morepypy.blogspot.fr/2010/11/efficiently-implementing-python-objects.html Is there any analysis of how this balances increased memory usage from the JIT vs the CPython VM (with a reasonable amount of code)? I'd thought that one of the main disadvantages of PyPy was drastically increased memory usage for any decent-sized program. Would be interested to know if this was not the case :) Cheers, Phil