Quoting Richard Fish <[EMAIL PROTECTED]>:

> I think we can finally finish this by assigning to the shared attribute
> if '_o' is defined, but *ALWAYS* setting the non-shared attribute.  With
> this technique, __getattr__ should only be called from signal handlers,
> where the instance won't contain the attribute, so we need to fetch it
> from the shared dictionary.

Here is the code from Demo/metaclasses/Meta.py:

    def __getattr__(self, name):
        try:
            return self.__realdict__[name]
        except KeyError:
            for base in self.__bases__:
                try:
                    return base.__getattr__(name)
                except AttributeError:
                    pass
            raise AttributeError, name

    def __setattr__(self, name, value):
        if not self.__inited:
            self.__dict__[name] = value
        else:
            self.__realdict__[name] = value

As you can see, you *must* call __getattr__ in the classes from which
you inhertied. This is probably what causes the problems: Gtk *and*
Python try to store the attributes. My question: Why is this so ?

Isn't it possible to install a "destroy" callback which deletes the
python object (so when the Gtk object is deleted, the Python object
is notified) ?

Then it should be possible to make the Python objects the "base" and
store the Gtk object in a field in the Python object and use Python
ways to do things.

--
Dipl. Inf. (FH) Aaron "Optimizer" Digulla     Assistent im BIKS Labor, FB WI
"(to) optimize: Make a program faster by      FH Konstanz, Brauneggerstr. 55
improving the algorithms rather than by       Tel:+49-7531-206-514
buying a faster machine."                     EMail: [EMAIL PROTECTED]
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to