Re: multiple inheritance of a dynamic list of classes?

2007-02-15 Thread Neil Cerutti
On 2007-02-15, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Feb 13, 9:14 am, Peter Otten <[EMAIL PROTECTED]> wrote: >> "Avoid inheritance" would be almost as justified :-) > > In other words, if you are inheriting just two or three methods > it may works, but when you start having dozens of me

Re: multiple inheritance of a dynamic list of classes?

2007-02-15 Thread Michele Simionato
On Feb 13, 9:14 am, Peter Otten <[EMAIL PROTECTED]> wrote: > "Avoid inheritance" would be almost as justified :-) Yep, I strongly agree. Inheritance is overrated, as Guido says. For what concerns the debate of multiple vs single inheritance, yes it is true that multiple inheritance is worse, but e

Re: multiple inheritance of a dynamic list of classes?

2007-02-14 Thread Neil Cerutti
On 2007-02-14, Peter Otten <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > >> On 2007-02-13, Peter Otten <[EMAIL PROTECTED]> wrote: >>> Well, what problems ocurring with >>> >>> class A: pass >>> class B: pass >>> class C(A, B): pass >>> >>> could be avoided by writing >>> >>> class A: pass >>>

Re: multiple inheritance of a dynamic list of classes?

2007-02-14 Thread Peter Otten
massimo s. wrote: > On 13 Feb, 12:46, Peter Otten <[EMAIL PROTECTED]> wrote: >> Well, what problems ocurring with >> >> class A: pass >> class B: pass >> class C(A, B): pass >> >> could be avoided by writing >> >> class A: pass >> class B(A): pass >> class C(B): pass >> >> instead? Classes have to

Re: multiple inheritance of a dynamic list of classes?

2007-02-14 Thread Peter Otten
Neil Cerutti wrote: > On 2007-02-13, Peter Otten <[EMAIL PROTECTED]> wrote: >> Well, what problems ocurring with >> >> class A: pass >> class B: pass >> class C(A, B): pass >> >> could be avoided by writing >> >> class A: pass >> class B(A): pass >> class C(B): pass >> >> instead? > > With multip

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi, > (snip) > - is there a better way than using multiple inheritance to plug-in > dynamically commands in a Cmd command line? Yes : use composition + delegation. Python makes it easy: #foo.py class Commands(object): def do_this(self,args): ...

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread massimo s.
On 13 Feb, 12:46, Peter Otten <[EMAIL PROTECTED]> wrote: > Well, what problems ocurring with > > class A: pass > class B: pass > class C(A, B): pass > > could be avoided by writing > > class A: pass > class B(A): pass > class C(B): pass > > instead? Classes have to be designed for subclassing, so e

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread Neil Cerutti
On 2007-02-13, Peter Otten <[EMAIL PROTECTED]> wrote: > Well, what problems ocurring with > > class A: pass > class B: pass > class C(A, B): pass > > could be avoided by writing > > class A: pass > class B(A): pass > class C(B): pass > > instead? With multiple inheritance, the choice of algorithm

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread Peter Otten
[EMAIL PROTECTED] wrote: > On 13 Feb, 09:14, Peter Otten <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >> > Thanks both for suggestions. I still think that using inheritance is >> > somehow cleanest in this case (I always hear the mantra "avoid >> > multiple inheritance!", but this is one

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread devicerandom
On 13 Feb, 09:14, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Thanks both for suggestions. I still think that using inheritance is > > somehow cleanest in this case (I always hear the mantra "avoid > > multiple inheritance!", but this is one of the cases it seems to make >

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Thanks both for suggestions. I still think that using inheritance is > somehow cleanest in this case (I always hear the mantra "avoid > multiple inheritance!", but this is one of the cases it seems to make > a lot of sense to me), but it's nice food for thought/code anyw

Re: multiple inheritance of a dynamic list of classes?

2007-02-12 Thread devicerandom
Thanks both for suggestions. I still think that using inheritance is somehow cleanest in this case (I always hear the mantra "avoid multiple inheritance!", but this is one of the cases it seems to make a lot of sense to me), but it's nice food for thought/code anyway. Other suggestions are always

Re: multiple inheritance of a dynamic list of classes?

2007-02-12 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi, > > I am currently using the Cmd module for a mixed cli+gui application. I > am starting to refactor my code and it would be highly desirable if > many commands could be built as simple plugins. > > My idea was: > - Load a list of plugin names (i.e. from the config

Re: multiple inheritance of a dynamic list of classes?

2007-02-12 Thread Michele Simionato
On Feb 12, 4:48 pm, [EMAIL PROTECTED] wrote: > - is there a better way than using multiple inheritance to plug-in > dynamically commands in a Cmd command line? I had to solve the same problem recently, and I decided to avoid multiple inheritance by using delegation. My idea was to make the Cmd cla

Re: multiple inheritance of a dynamic list of classes?

2007-02-12 Thread devicerandom
> Most of the above should be straight-forward. I used type(cmd.Cmd)(name, > bases, classdict) instead of just type(name, bases, classdict) because > cmd.Cmd is a classic class. It seems it works. It is not so straight-forward to me because I don't know about new-style types and classes very well

Re: multiple inheritance of a dynamic list of classes?

2007-02-12 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I am currently using the Cmd module for a mixed cli+gui application. I > am starting to refactor my code and it would be highly desirable if > many commands could be built as simple plugins. > > My idea was: > - Load a list of plugin names (i.e. from the config file, or

multiple inheritance of a dynamic list of classes?

2007-02-12 Thread devicerandom
Hi, I am currently using the Cmd module for a mixed cli+gui application. I am starting to refactor my code and it would be highly desirable if many commands could be built as simple plugins. My idea was: - Load a list of plugin names (i.e. from the config file, or from the plugins directory) - Im