Re: "isinstance" question

2010-06-23 Thread Thomas Jollans
On 06/23/2010 08:39 AM, Satish Eerpini wrote: > > > I want to test whether an object is an instance of any > user-defined > class. "isinstance" is less helpful than one would expect. > > >>> import types > >>> class foo() : # define dummy class >

Re: "isinstance" question

2010-06-22 Thread Satish Eerpini
> >I want to test whether an object is an instance of any user-defined >> class. "isinstance" is less helpful than one would expect. >> >> >>> import types >> >>> class foo() : # define dummy class >> ... pass >> ... >> >>> x = foo() >> >>> >> >>> type(x) >> >> >>> >> >>> isinstanc

Re: "isinstance" question

2010-06-22 Thread Gabriel Genellina
En Tue, 22 Jun 2010 23:45:07 -0300, John Nagle escribió: I want to test whether an object is an instance of any user-defined class. "isinstance" is less helpful than one would expect. >>> import types >>> class foo() : # define dummy class ... pass ... >>> x = foo() >>> >>> type

Re: "isinstance" question

2010-06-22 Thread John Nagle
On 6/22/2010 8:13 PM, Ben Finney wrote: John Nagle writes: I want to test whether an object is an instance of any user-defined class. "isinstance" is less helpful than one would expect. Right. The type hierarchy is now unified; there's essentially no difference in later Python versions b

Re: "isinstance" question

2010-06-22 Thread Ben Finney
John Nagle writes: > I want to test whether an object is an instance of any user-defined > class. "isinstance" is less helpful than one would expect. Right. The type hierarchy is now unified; there's essentially no difference in later Python versions between user-defined types and built-in ty

"isinstance" question

2010-06-22 Thread John Nagle
I want to test whether an object is an instance of any user-defined class. "isinstance" is less helpful than one would expect. >>> import types >>> class foo() : # define dummy class ... pass ... >>> x = foo() >>> >>> type(x) >>> >>> isinstance(x, types.ClassType) False >>> isinstance(x,