Before all, I'm not a professional programmer but just a biophysics
ph.d. student, so if something makes you scream of horror, please
forgive me...
Ok, this is not straightforward at all.
I am working on an application that uses plugins. Plugins are coded as
small classes that become inherited by
At this point, it seems too much a deep object-oriented hell to be
able to dig it myself. Would you help me getting some cue on the
problem?
Update. Now I know that:
- every sane Python class should return type 'instance' after
type(self)
- when disabling the multiple-inheritance-hack, the
massimo s. [EMAIL PROTECTED] wrote:
Now I know that:
- every sane Python class should return type 'instance' after
type(self)
Wrong. Only old style classes are 'instance' type, and you should never be
using an old style class unless you have a very good reason for it. Always
use 'object'
massimo s. a écrit :
At this point, it seems too much a deep object-oriented hell to be
able to dig it myself. Would you help me getting some cue on the
problem?
Update. Now I know that:
- every sane Python class should return type 'instance' after
type(self)
Certainly not, unless you're
On 28 Giu, 13:45, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
massimo s. a écrit :
At this point, it seems too much a deep object-oriented hell to be
able to dig it myself. Would you help me getting some cue on the
problem?
Update. Now I know that:
- every sane Python class
On 28 Giu, 13:45, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
side-note
wrt/ this snippet:
for plugin_name in self.config['plugins']:
try:
plugin=__import__(plugin_name)
try:
print type(self)
On 28 Giu, 13:45, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
wxFrame is obviously a new-style class.
I don't know if it's true, however. I tried that:
class A(object):
... def __init__(self):
... print type(self)
...
a=A()
class '__main__.A'
so in fact what I see
massimo s. wrote:
On 28 Giu, 13:45, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
massimo s. a écrit :
At this point, it seems too much a deep object-oriented hell to be
able to dig it myself. Would you help me getting some cue on the
problem?
Update. Now I know that:
- every sane
On 28 Giu, 14:41, massimo s. [EMAIL PROTECTED] wrote:
The new-style behaviour only appears when wxFrame is plugged with the
current hack.
That is:
- print type(self) in wxFrame alone returns type 'instance'
- print type(self) in the plugged (multiply inherited) wxFrame returns
class
massimo s. wrote:
Again: using a new-style plugin class for multiple inheritance does
not work.
This statement is certainly too broad.
[earlier]
TypeError: unbound method _plug_init() must be called with
dummyguiplugGui instance as first argument (got MainWindowPlugged
instance instead)
On 28 Giu, 15:37, Peter Otten [EMAIL PROTECTED] wrote:
massimo s. wrote:
Again: using a new-style plugin class for multiple inheritance does
not work.
This statement is certainly too broad.
[earlier]
TypeError: unbound method _plug_init() must be called with
dummyguiplugGui instance
massimo s. a écrit :
On 28 Giu, 13:45, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
side-note
wrt/ this snippet:
for plugin_name in self.config['plugins']:
try:
plugin=__import__(plugin_name)
try:
print type(self)
massimo s. a écrit :
On 28 Giu, 14:41, massimo s. [EMAIL PROTECTED] wrote:
The new-style behaviour only appears when wxFrame is plugged with the
current hack.
That is:
- print type(self) in wxFrame alone returns type 'instance'
- print type(self) in the plugged (multiply inherited)
On 28 Giu, 15:37, Peter Otten [EMAIL PROTECTED] wrote:
Post a self-contained example.
Now I'm even more confused. The self-contained example is below... and
it works, using only old-style declarations.
#!/usr/bin/env python
import wx
import cmd
global CLI_PLUGINS
global GUI_PLUGINS
class
Uh, oh.
I think I found the bug, and it was a *really stupid bug*.
The list of GUI_PLUGINS was empty... so there was no plugin class that
was inherited.
I'm embarrassed to have wasted your time that way. However I learned a
lot about new-style classes and so on, so for me it was a learning
15 matches
Mail list logo