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
>
>
>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
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
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
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
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,