Re: How to examine the inheritance of a class?

2008-10-25 Thread Fuzzyman
On Oct 24, 7:27 pm, Derek Martin [EMAIL PROTECTED] wrote: On Fri, Oct 24, 2008 at 11:59:46AM +1000, James Mills wrote: On Fri, Oct 24, 2008 at 11:36 AM, John Ladasky [EMAIL PROTECTED] wrote: etc.  The list of subclasses is not fully defined.  It is supposed to be extensible by the user.

Re: How to examine the inheritance of a class?

2008-10-24 Thread Steven D'Aprano
On Thu, 23 Oct 2008 20:53:03 -0700, John Ladasky wrote: On Oct 23, 6:59 pm, James Mills [EMAIL PROTECTED] wrote: Developer. NOT User. For the foreseeable future, this program is for my use only. So the developer and the user are one and the same. And, thank you, __bases__ is what I

Re: How to examine the inheritance of a class?

2008-10-24 Thread Derek Martin
On Fri, Oct 24, 2008 at 11:59:46AM +1000, James Mills wrote: On Fri, Oct 24, 2008 at 11:36 AM, John Ladasky [EMAIL PROTECTED] wrote: etc. The list of subclasses is not fully defined. It is supposed to be extensible by the user. Developer. NOT User. It's a semantic argument, but John's

Re: How to examine the inheritance of a class?

2008-10-24 Thread Craig Allen
Developer. NOT User. I go around and around on this issue, and have ended up considering anyone using my code a user, and if it's a library or class system, likely that user is a programmer. I don't really think there is a strong distinction... more and more users can do sophisticated

Re: How to examine the inheritance of a class?

2008-10-24 Thread Craig Allen
Thank you, Chris. Class.__bases__ is exactly what I wanted to see. And I thought I had tried isinstance(), and found it lacking -- but I just tried it again, and it does what I hoped it would do. While isinstance is no doubt the proper way to access this information, you may have run into

How to examine the inheritance of a class?

2008-10-23 Thread John Ladasky
Hello again! Suppose that I have several subclasses which inherit from a base class, thus: class Foo(object): class Spam1(Foo): class Spam2(Foo): class Spam3(Foo): etc. The list of subclasses is not fully defined. It is supposed to be extensible by the user. Many methods will differ

Re: How to examine the inheritance of a class?

2008-10-23 Thread John Ladasky
I forgot to add -- though I suspect it should not matter -- I'm using Python 2.5.1 on Ubuntu Linux 8.04. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to examine the inheritance of a class?

2008-10-23 Thread Chris Rebert
On Thu, Oct 23, 2008 at 6:36 PM, John Ladasky [EMAIL PROTECTED] wrote: Hello again! Suppose that I have several subclasses which inherit from a base class, thus: class Foo(object): class Spam1(Foo): class Spam2(Foo): class Spam3(Foo): etc. The list of subclasses is not fully

Re: How to examine the inheritance of a class?

2008-10-23 Thread James Mills
On Fri, Oct 24, 2008 at 11:36 AM, John Ladasky [EMAIL PROTECTED] wrote: etc. The list of subclasses is not fully defined. It is supposed to be extensible by the user. Developer. NOT User. Consider: $ python Python 2.5.2 (r252:60911, Oct 13 2008, 15:09:03) [GCC 4.2.4 (CRUX)] on linux2 Type

Re: How to examine the inheritance of a class?

2008-10-23 Thread John Ladasky
On Oct 23, 6:56 pm, Chris Rebert [EMAIL PROTECTED] wrote: In __bases__, e.g. Spam1.__bases__, which would be (class '__main__.Foo',). In practice, you probably just want to use if isinstance(some_obj, Foo): which will be true for SpamN instances. Thank you, Chris. Class.__bases__ is

Re: How to examine the inheritance of a class?

2008-10-23 Thread John Ladasky
On Oct 23, 6:59 pm, James Mills [EMAIL PROTECTED] wrote: Developer. NOT User. For the foreseeable future, this program is for my use only. So the developer and the user are one and the same. And, thank you, __bases__ is what I was looking for. Though Chris Mills also pointed out that