[Python-Dev] Meta-reflections

Kevin Jacobs jacobs@penguin.theopalgroup.com
Tue, 19 Feb 2002 12:53:03 -0500 (EST)

On Tue, 19 Feb 2002, Samuele Pedroni wrote:
> Slots are already not flat.
> They have basically a similar behavior to fields
> in JVM object model (and I presume in .NET).

I agree, but do we want slots to be non-flat?  It goes very much against the
traditional Python idiom.  In my opinion, I believe that slots should have
exactly the same semantics as normal instance attributes, except for
how/where they are allocated.

> Given that implementing slots with fields is one of the possibility for
> Jython

This is possible for flat slot namespaces too; just remap new slots to
existing ones when they overlap, instead of allocating a new one.

> Consider also:
> >>> class Goo(object):
> ...  __slots__ = ('a',)
> ...
> >>> class Bar(Goo,Foo): pass
> ...
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: multiple bases have instance lay-out conflict
> that helps and reinforces that model.

I'll contend that the current implementation is flawed for this and several
other reasons I've stated in my previous e-mails.  Of course, we're waiting
to hear back from Guido when he returns, since his opinion is infinitely
more important than mine in this matter.


Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com