Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Bernard Lebel
Okay. right now I'm using types.InstanceType approach. To elaborate on the context of my question, I have this module whose only job is to test an object against a large array of types. The thing is that I never know in advance what is going to be the data, and it could be just about anything

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Kent Johnson
Jerry Hill wrote: > I believe you can check for an instance of a new-style class > with: > isinstance(a, object) I'm not sure if that will ever fail. Given values from my previous post, I get: In [16]: isinstance(a, object) Out[16]: True In [17]: isinstance(A, object) Out[17]: True In [18]: isins

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Kent Johnson
Bernard Lebel wrote: > That's fine, but that tells me that 'a' is an instance of 'A'. > It doesn't, however, tell me if 'a' is an instance or the actual class object. I'm not sure what you are trying to do. In [1]: class A: pass ...: In [2]: a=A() In [3]: isinstance(a, A) Out[3]: True In [4]:

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Jerry Hill
On 2/26/07, Bernard Lebel <[EMAIL PROTECTED]> wrote: > That's fine, but that tells me that 'a' is an instance of 'A'. > It doesn't, however, tell me if 'a' is an instance or the actual class object. It doesn't? >>> class A: pass >>> a = A() >>> isinstance(a, A) True >>> isinstance(A, A)

Re: [Tutor] FW: isinstance -> instance

2007-02-26 Thread Bernard Lebel
That's fine, but that tells me that 'a' is an instance of 'A'. It doesn't, however, tell me if 'a' is an instance or the actual class object. Thanks Bernard On 2/26/07, Mike Hansen <[EMAIL PROTECTED]> wrote: > Oops...I replied instead of replied all. > > > -Original Message- > > From:

[Tutor] FW: isinstance -> instance

2007-02-26 Thread Mike Hansen
Oops...I replied instead of replied all. > -Original Message- > From: Mike Hansen > Sent: Monday, February 26, 2007 2:43 PM > To: 'Bernard Lebel' > Subject: RE: [Tutor] isinstance -> instance > > > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECT