Re: When is a subclass not right?

2006-08-25 Thread Carl Banks
David Ells wrote: > Carl Banks wrote: > > The classical advice in choosing whether to subclass or or use > > attribute is whether its more an an "is a" or "has a" relationship. If > > it's more natural to say B is an A, then subclass. If it's more > > natural to say B has an A, then use an attr

Re: When is a subclass not right?

2006-08-25 Thread David Ells
Carl Banks wrote: > > I think it's kind of a fine point. In my own code I've had cases where > I've switched from subclass to attribute and back over the development, > and vice versa. I think there are many cases where it's preferable to > use an attribute, but not really wrong to subclass (and

Re: When is a subclass not right?

2006-08-25 Thread David Ells
Chaz Ginger wrote: > I was writing some code that used someone else class as a subclass. He > wrote me to tell me that using his class as a subclass was incorrect. I > am wondering under what conditions, if ever, does a class using a > subclass not work. > > Here is an example. For instance the ori

Re: When is a subclass not right?

2006-08-24 Thread Gabriel Genellina
At Thursday 24/8/2006 19:51, Chaz Ginger wrote: >> I was writing some code that used someone else class as a subclass. He >> wrote me to tell me that using his class as a subclass was incorrect. I >> am wondering under what conditions, if ever, does a class using a >> subclass not work. >> >> cl

Re: When is a subclass not right?

2006-08-24 Thread Rick Zantow
Gabriel Genellina <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > At Thursday 24/8/2006 17:44, Chaz Ginger wrote: > >>That is merely a logical use of OO after all when would a car and an >>orange be the same? > > Uh... what's the point...? > By example, an orange inside a car would be mo

Re: When is a subclass not right?

2006-08-24 Thread Gabriel Genellina
At Thursday 24/8/2006 17:44, Chaz Ginger wrote: >> I was writing some code that used someone else class as a subclass. He >> wrote me to tell me that using his class as a subclass was incorrect. I >> am wondering under what conditions, if ever, does a class using a >> subclass not work. >> >> cl

Re: When is a subclass not right?

2006-08-24 Thread Chaz Ginger
Gabriel Genellina wrote: > At Thursday 24/8/2006 16:23, Chaz Ginger wrote: > >> I was writing some code that used someone else class as a subclass. He >> wrote me to tell me that using his class as a subclass was incorrect. I >> am wondering under what conditions, if ever, does a class using a >>

Re: When is a subclass not right?

2006-08-24 Thread Chaz Ginger
Fredrik Lundh wrote: > please don't hit reply to arbitrary messages when you're posting new > messages; it messes up the message threading. > > Chaz Ginger wrote: > >> I was writing some code that used someone else class as a subclass. He >> wrote me to tell me that using his class as a subclass

Re: When is a subclass not right?

2006-08-24 Thread Gabriel Genellina
At Thursday 24/8/2006 16:23, Chaz Ginger wrote: I was writing some code that used someone else class as a subclass. He wrote me to tell me that using his class as a subclass was incorrect. I am wondering under what conditions, if ever, does a class using a subclass not work. class B1(A); def

Re: When is a subclass not right?

2006-08-24 Thread Carl Banks
Chaz Ginger wrote: > I was writing some code that used someone else class as a subclass. He > wrote me to tell me that using his class as a subclass was incorrect. I > am wondering under what conditions, if ever, does a class using a > subclass not work. [snip] > He said I should use it this way:

Re: When is a subclass not right?

2006-08-24 Thread Simon Forman
Chaz Ginger wrote: > I was writing some code that used someone else class as a subclass. He > wrote me to tell me that using his class as a subclass was incorrect. I > am wondering under what conditions, if ever, does a class using a > subclass not work. > > Here is an example. For instance the ori

Re: When is a subclass not right?

2006-08-24 Thread Fredrik Lundh
please don't hit reply to arbitrary messages when you're posting new messages; it messes up the message threading. Chaz Ginger wrote: > I was writing some code that used someone else class as a subclass. He > wrote me to tell me that using his class as a subclass was incorrect. I > am wondering

When is a subclass not right?

2006-08-24 Thread Chaz Ginger
I was writing some code that used someone else class as a subclass. He wrote me to tell me that using his class as a subclass was incorrect. I am wondering under what conditions, if ever, does a class using a subclass not work. Here is an example. For instance the original class might look like