[Python-Dev] Meta-reflections

David Ascher DavidA@ActiveState.com
Wed, 20 Feb 2002 11:57:37 -0800


Kevin:

> > My take on this thread is that I think it's simply not going to happen
> > that slots are going to act 100% like attributes except for
> > performance/memory considerations.  It would be nice, but if that had
> > been possible, then they'd simply be an internal optimization and would
> > have no syntactic impact.
> 
> I'd like to know why else you think that?  

Ye old poverty of the imagination argument, coupled with the assumption
that Guido had time to finish what he'd started I guess =).

> I'm fairly confident that I can
> submit a patch that accomplishes this (and even fix the following issue).

Great!  

I can't channel Guido very well, but everytime that he's talked about
slots in my presence, he talked about their main purpose as a
memory-savings one.  If he didn't have other intents, and if you can
limit their impact to pure memory savings, then more power to all of us
thanks to you.

> Ouch!  You've discovered another problem with the current implementation.
> You have effectively removed the slot descriptor from class A and replaced
> it with a class attribute.  In fact, I don't think you can ever re-create
> the slot descriptor!  

Ooh, cool.  You're right:

after deleting the class attribute:

>>> a.a = 1100
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'A' object has no attribute 'a'

which is a really wacky error message if you look at the case of the
letters...

--david