Re: Inheritable Slots Metaclass

2010-05-31 Thread Aahz
In article <5a3a5737-f1b7-4419-9bb3-088c244a4...@c13g2000vbr.googlegroups.com>, Carl Banks wrote: > >However, Aahz will be by shortly to tell you never to use slots. Please note that there is an important distinction between "don't use slots" and "never use slots" -- if you can locate any instan

Re: Inheritable Slots Metaclass

2010-05-26 Thread Carl Banks
On May 26, 9:55 pm, Carl Banks wrote: > I don't want to sound to pessimistic about it, I really wouldn't mind > a metaclass that makes slots more normal; but you have work to do. Just as a minor followup, I'll mention that slots and inheritance have some issues that aren't going to be resolvable

Re: Inheritable Slots Metaclass

2010-05-26 Thread Carl Banks
On May 26, 8:33 pm, Rebel Lion wrote: > > I'd be ok with a metatype in the standard library that makes slots > > more transparent, but since slots are intended as an optimization, it > > doesn't really need (and might be detrimental to have) transparency > > for ordinary objects. > > But why there

Re: Inheritable Slots Metaclass

2010-05-26 Thread John Nagle
Rebel Lion wrote: I'd be ok with a metatype in the standard library that makes slots more transparent, but since slots are intended as an optimization, it doesn't really need (and might be detrimental to have) transparency for ordinary objects. But why there is __slots__ if it's not indeed nee

Re: Inheritable Slots Metaclass

2010-05-26 Thread Rebel Lion
> I'd be ok with a metatype in the standard library that makes slots > more transparent, but since slots are intended as an optimization, it > doesn't really need (and might be detrimental to have) transparency > for ordinary objects. > But why there is __slots__ if it's not indeed needed. we sho

Re: Inheritable Slots Metaclass

2010-05-26 Thread Carl Banks
On May 26, 2:51 pm, geremy condra wrote: > On Wed, May 26, 2010 at 1:50 PM, Carl Banks wrote: > > On May 26, 5:49 am, Rebel Lion wrote: > >> I made a metaclass to inherit __slots__ automatically. > > >> I think this feature should be included in builtin object's metaclass. > > > I'd be ok with a

Re: Inheritable Slots Metaclass

2010-05-26 Thread geremy condra
On Wed, May 26, 2010 at 1:50 PM, Carl Banks wrote: > On May 26, 5:49 am, Rebel Lion wrote: >> I made a metaclass to inherit __slots__ automatically. >> >> I think this feature should be included in builtin object's metaclass. > > I'd be ok with a metatype in the standard library that makes slots

Re: Inheritable Slots Metaclass

2010-05-26 Thread Carl Banks
ss Bar(): bar = slot Then replace "isinstance(v,slot)" with "v is slot" in the metaclass. > Here is the metaclass: > > class slot(object): >     """Slot Decorator""" > >     def __init__(self, func): >         pass > > c

Inheritable Slots Metaclass

2010-05-26 Thread Rebel Lion
;foo'] class Bar(Foo) __slots__ = ['foo', 'bar'] Please discuss the pros & cons for this feature. Here is the metaclass: class slot(object): """Slot Decorator""" def __init__(self, func): pass class SlotMe