advice on programming style: is multiple inheritance bad?

U

Uwe Mayer

Hi,

Michael said:
Weird. I take it you've reported this to the PyQT folks?

After you said, I did. I just received response that this was already fixed
in the CVS snapshot 20040202 :).

I also reported a bug in pyuic, which left out a "self." in front of a
toolbar object when you GUI had a spacer object in the toolbar.
That's however still a problem.

Ciao
Uwe
 
A

Aahz

I thought about that when new style classes came out, and managed
to convince myself that it couldn't happen, at least with data
properties. Unless trying to set the *same* attribute from the setter
invoked from the property actually works? That seems like a lot of work
to make it function poorly.

I'm not understanding your question.
 
A

Aahz

I assume the work you did last year is the cache-attr-branch in the
CVS? Is there some documentation somewhere that more fully describes
the reasons for your approach (and possibly rejected alternatives)?

That's the patch. Unfortunately, I don't think there's much doc.
I wonder if you considered turning off the cache for types with
no instance dict (tp_dictoffset == 0)? The slowdown in access to
attributes defined in the first class in the mro is probably most
critical for built-in types (without instance dicts), which access both
methods and data using class attributes. For types implemented in
Python, I for one would be willing to trade some slow down in accessing
class attributes (generally a prelude to making a Python function
call, which is going to be relatively slow anyway), for a speed up in
accessing instance attributes.

That's what I thought, too, but there was some reason Guido wasn't
willing to live with that, which I can't remember.
 
J

John Roth

Aahz said:
I'm not understanding your question.

In order to determine if something is a property, you have to scan
the MRO to find a descriptor. Correct? The only real problem case
here is if the instance has an attribute that is named the same as the
descriptor. My understanding is that this wasn't allowed, thus
eliminating the necessity of scanning the MRO when the attribute
was sitting right there in front of one.

Now if the original discussion was about speeding up the descriptor
search in the general case, then I misunderstood the issue.

John Roth

Bach
 
A

Aahz

In order to determine if something is a property, you have to scan
the MRO to find a descriptor. Correct? The only real problem case
here is if the instance has an attribute that is named the same as the
descriptor. My understanding is that this wasn't allowed, thus
eliminating the necessity of scanning the MRO when the attribute
was sitting right there in front of one.

Now if the original discussion was about speeding up the descriptor
search in the general case, then I misunderstood the issue.

Unfortunately, because one can assign to <object>.__dict__, there's no
way of preventing the existance of an object attribute. (Was going to
write more, but don't have time.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,969
Members
47,524
Latest member
ecomwebdesign

Latest Threads

Top