Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70543
| Date | 2014-04-23 14:59 +0100 |
|---|---|
| From | Phil Connell <pconnell@gmail.com> |
| Subject | Re: object().__dict__ |
| References | <51d9b7f1-3511-4110-adb2-aa2226bd7a3c@lists.xtsubasa.org> <20140423061123.GA47008@cskk.homeip.net> <CAL7_Mo9Hb44ZPEw2UvKcRDiugw-Voh0y=JoMHqGKYHzY8dyKrA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9466.1398261579.18130.python-list@python.org> (permalink) |
On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > 2014-04-23 8:11 GMT+02:00 Cameron Simpson <cs@zip.com.au>: > > 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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: object().__dict__ Phil Connell <pconnell@gmail.com> - 2014-04-23 14:59 +0100
csiph-web