Re: It's ok to __slots__ for what they were intended (was: Don't use __slots__ (was Re: Why custom objects take so much memory?))

2007-12-21 Thread Chris Mellon
On 20 Dec 2007 19:50:31 -0800, Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Carl Banks <[EMAIL PROTECTED]> wrote: > >On Dec 18, 4:49 pm, [EMAIL PROTECTED] (Aahz) wrote: > >> In article <[EMAIL PROTECTED]>, > >> Chris Mellon <[EMAIL PROTECTED]> wrote: > >>> > >>>You can reduc

Re: It's ok to __slots__ for what they were intended (was: Don't use __slots__ (was Re: Why custom objects take so much memory?))

2007-12-20 Thread Aahz
In article <[EMAIL PROTECTED]>, Carl Banks <[EMAIL PROTECTED]> wrote: >On Dec 18, 4:49 pm, [EMAIL PROTECTED] (Aahz) wrote: >> In article <[EMAIL PROTECTED]>, >> Chris Mellon <[EMAIL PROTECTED]> wrote: >>> >>>You can reduce the size of new-style classes (inherit from object) by >>>quite a bit if yo

Re: It's ok to __slots__ for what they were intended (was: Don't use __slots__ (was Re: Why custom objects take so much memory?))

2007-12-18 Thread Carl Banks
On Dec 18, 4:49 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > > Chris Mellon <[EMAIL PROTECTED]> wrote: > > >You can reduce the size of new-style classes (inherit from object) by > >quite a bit if you use __slots__ to eliminate the class dictionary. > > You can also reduce

RE: Don't use __slots__ (was Re: Why custom objects take so much memory?)

2007-12-18 Thread Delaney, Timothy (Tim)
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Chris Mellon <[EMAIL PROTECTED]> wrote: >> >> You can reduce the size of new-style classes (inherit from object) by >> quite a bit if you use __slots__ to eliminate the class dictionary. > > You can also reduce your functionality quite a bit by usi

Don't use __slots__ (was Re: Why custom objects take so much memory?)

2007-12-18 Thread Aahz
In article <[EMAIL PROTECTED]>, Chris Mellon <[EMAIL PROTECTED]> wrote: > >You can reduce the size of new-style classes (inherit from object) by >quite a bit if you use __slots__ to eliminate the class dictionary. You can also reduce your functionality quite a bit by using __slots__. Someday I'll

Re: Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-15 Thread Aahz
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: >Aahz wrote: >> In article <[EMAIL PROTECTED]>, >> Steven Bethard <[EMAIL PROTECTED]> wrote: >>> >>> You can use __slots__ [...] >> >> Aaaugh! Don

Re: Don't use __slots__

2007-10-08 Thread Hrvoje Niksic
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Well, I've read the thread, and I've read the thread it links to, > and for the life of me I'm still no clearer as to why __slots__ > shouldn't be used except that: [...] > But is there actually anything *harmful* that can happen if I use > __slots__?

Re: Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-08 Thread Steven Bethard
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Steven Bethard <[EMAIL PROTECTED]> wrote: >> You can use __slots__ [...] > > Aaaugh! Don't use __slots__! > > Seriously, __slots__ are for wizards writing applications with huuuge > numbers of object i

Re: Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-08 Thread Diez B. Roggisch
Steven D'Aprano wrote: > On Mon, 08 Oct 2007 15:15:36 +0200, Diez B. Roggisch wrote: > >>> Well, I've read the thread, and I've read the thread it links to, and >>> for the life of me I'm still no clearer as to why __slots__ shouldn't >>> be used except that: >>> >>> 1 Aahz and Guido say __slots

Re: Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-08 Thread Steven D'Aprano
On Mon, 08 Oct 2007 15:15:36 +0200, Diez B. Roggisch wrote: >> Well, I've read the thread, and I've read the thread it links to, and >> for the life of me I'm still no clearer as to why __slots__ shouldn't >> be used except that: >> >> 1 Aahz and Guido say __slots__ are teh suxxor; >> >> 2 rumou

Re: Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-08 Thread Diez B. Roggisch
Steven D'Aprano wrote: > On Sun, 07 Oct 2007 21:27:31 -0700, Aahz wrote: > >> In article <[EMAIL PROTECTED]>, Steven >> Bethard <[EMAIL PROTECTED]> wrote: >>> >>>You can use __slots__ [...] >> >> Aaaugh! Don't use __slo

Re: Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-08 Thread Steven D'Aprano
On Sun, 07 Oct 2007 21:27:31 -0700, Aahz wrote: > In article <[EMAIL PROTECTED]>, Steven > Bethard <[EMAIL PROTECTED]> wrote: >> >>You can use __slots__ [...] > > Aaaugh! Don't use __slots__! > > Seriously, __slots__ are for wizards writi

Re: Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-07 Thread Michele Simionato
On Oct 8, 12:27 am, [EMAIL PROTECTED] (Aahz) wrote: > > Aaaugh! Don't use __slots__! +1 QOTW ;) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Don't use __slots__ (was Re: Problem of Readability of Python)

2007-10-07 Thread Aahz
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > >You can use __slots__ [...] Aaaugh! Don't use __slots__! Seriously, __slots__ are for wizards writing applications with huuuge numbers of object instances (like, millions of instances). For a

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-29 Thread Antoon Pardon
On 2006-08-27, Jacob Hallen <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Patrick Maupin <[EMAIL PROTECTED]> wrote: > > Unfortunately there is a side effect to slots. They change the behaviour of > the objects that have slots in a way that can be abused by control freaks > and stat

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-28 Thread Patrick Maupin
Dieter Maurer wrote: > "Patrick Maupin" <[EMAIL PROTECTED]> writes on 26 Aug 2006 12:51:44 -0700: > > ... > > The only > > problem I personally know of is that the __slots__ aren't inherited, > > "__slots__" *ARE* inherited, although the rules may be a bit > complex. Yes, I didn't write that corr

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-28 Thread Dieter Maurer
"Patrick Maupin" <[EMAIL PROTECTED]> writes on 26 Aug 2006 12:51:44 -0700: > ... > The only > problem I personally know of is that the __slots__ aren't inherited, "__slots__" *ARE* inherited, although the rules may be a bit complex. >>> class B(object): ... __slots__ = ('f1', 'f2',) ... >>> cla

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-27 Thread David Isaac
"Jacob Hallen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Unfortunately there is a side effect to slots. They change the behaviour of > the objects that have slots in a way that can be abused by control freaks > and static typing weenies. This is bad, because the contol freaks s

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-27 Thread Patrick Maupin
Jacob Hallen wrote: > Patrick Maupin <[EMAIL PROTECTED]> wrote: > >Also, as I noted, I _do_ use them on occasion, so if there really _are_ > >potential pitfalls there, I would like to understand exactly what they > >are, so my ears perk up whenever I notice a __slots__ discussion, but > >so far I

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-27 Thread Jacob Hallen
In article <[EMAIL PROTECTED]>, Patrick Maupin <[EMAIL PROTECTED]> wrote: >I didn't actually sense any dander on your part, so it was probably a >bit unfortunate that I chose to respond to that particular message. I >do (rightly or wrongly) sense some dander on Aahz's part, and this was >the secon

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Carl Banks
Patrick Maupin wrote: > The only assertion that was made explicitly enough to be testable came > about in a followup to Aahz's original post, only AFTER someone asked > what the side-effects associated with __slots__ were. Aahz responded: > > > The main one is that inheritance becomes difficult t

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Patrick Maupin
Jarek Zgoda wrote: > Having that said, should we hope __slots__ would disappear in (some) > future (tomorrow?!, in next 10 microseconds?!)? Please, don't left us > hopeless. > Are you saying you _do_ hope that __slots__ disappear? Why? Regards, Pat -- http://mail.python.org/mailman/listinfo/p

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Patrick Maupin
[EMAIL PROTECTED] wrote: > Aahz> Taking a look at __slots__ is fine as long as you don't actually > Aahz> use them. > > Gabriel> Why? > > Skip> > http://groups.google.com/group/comp.lang.python/browse_thread/thread/451ad25f9c648404/f4ac2dfde32b16fd?lnk=st&q=Python+__slots__+aahz&rnum=

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Jarek Zgoda
[EMAIL PROTECTED] napisał(a): > That said, It's not mentioned on the Python3.0 page of the wiki: > > http://wiki.python.org/moin/Python3.0 > > or in PEP 3000: > > http://www.python.org/dev/peps/pep-3000/ > > and I see no discussion about it in the Python 3000 mailing list archives: >

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread skip
Aahz> Taking a look at __slots__ is fine as long as you don't actually Aahz> use them. Gabriel> Why? Skip> http://groups.google.com/group/comp.lang.python/browse_thread/thread/451ad25f9c648404/f4ac2dfde32b16fd?lnk=st&q=Python+__slots__+aahz&rnum=2#f4ac2dfde32b16fd Patrick>

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-26 Thread Patrick Maupin
[EMAIL PROTECTED] wrote: > Aahz> Taking a look at __slots__ is fine as long as you don't actually > Aahz> use them. > > Gabriel> Why? > http://groups.google.com/group/comp.lang.python/browse_thread/thread/451ad25f9c648404/f4ac2dfde32b16fd?lnk=st&q=Python+__slots__+aahz&rnum=2#f4ac2dfde32b16

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs.object attributes)

2006-08-25 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I think that the official python documentation has to become more like > wikipedia, where people can fix it more easely, so I can add such > warning into the text. comment away: http://pyref.infogami.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread bearophileHUGS
Aahz wrote: > Taking a look at __slots__ is fine as long as you don't actually use them. I remember the recent discussion about such matters... but I don't understand its dangers fully still. I assume __slots__ may be removed in Python 3.0, but maybe "experts" need it now an then. Or maybe a "expe

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread skip
Aahz> Taking a look at __slots__ is fine as long as you don't actually Aahz> use them. Gabriel> Why? http://groups.google.com/group/comp.lang.python/browse_thread/thread/451ad25f9c648404/f4ac2dfde32b16fd?lnk=st&q=Python+__slots__+aahz&rnum=2#f4ac2dfde32b16fd Skip -- http://mail.pyt

Re: Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread Gabriel Genellina
At Friday 25/8/2006 11:34, Aahz wrote: >The results seem okay. Python is a dynamic language, object attributes >(and methods, etc) are kept inside a dict, where you can add and remove >them when you like. So using a dict is faster. >You can also take a look at __slots__ Taking a look at __slots_

Don't use __slots__ (was Re: performance of dictionary lookup vs. object attributes)

2006-08-25 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Andre Meyer: >> >> Is the test meaningful and are you surprised by the results? >> I am, actually, because I would have assumed that attribute access >> with an object should be faster because lookup can be precompiled. > >The results see

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-28 Thread Aahz
In article <[EMAIL PROTECTED]>, Roy Smith <[EMAIL PROTECTED]> wrote: >>Guido sez: >> >> __slots__ is a terrible hack with nasty, hard-to-fathom side >> effects that should only be used by programmers at grandmaster and >> wizard levels. Unfortunately it has gained an enormous undeserved

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Roy Smith
>Guido sez: > > __slots__ is a terrible hack with nasty, hard-to-fathom side > effects that should only be used by programmers at grandmaster and > wizard levels. Unfortunately it has gained an enormous undeserved > popularity amongst the novices and apprentices, who should know >

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Aahz, citing Guido: >> >>__slots__ is a terrible hack with nasty, hard-to-fathom side >>effects that should only be used by programmers at grandmaster and >>wizard levels. Unfortunately it has gained an enormous undeserved > >I think I ha

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread bearophileHUGS
Aahz, citing Guido: >__slots__ is a terrible hack with nasty, hard-to-fathom side >effects that should only be used by programmers at grandmaster and >wizard levels. Unfortunately it has gained an enormous undeserved I think I have used __slots__ just one time. Can you tell me some of of such bad

Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Aahz
In article <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >In <[EMAIL PROTECTED]>, Guyon Morée >wrote: >> >> I'm using simple classes as a container of named values and I'm >> instantiating a lot of them in a very short time. >> >> i was wondering if there is any benefi

Don't use __slots__ (was Re: __slots__ in derived class)

2006-03-15 Thread Aahz
In article <[EMAIL PROTECTED]>, =?ISO-8859-1?Q?Sch=FCle_Daniel?= <[EMAIL PROTECTED]> wrote: > >does __slots__ nothing when used in derived classes? Short answer: don't use __slots__ until you're comfortable writing metaclasses and decorators. __slots__ are a p