Joesph someone...@gmail.com added the comment:
And much sense is made. If there is a generic instance test that I have
missed I'd be willing to work around this minor flaw. That the definition is
an instance of 'object' is a case that should be handled by the function
though.
On May 28, 2011
R. David Murray rdmur...@bitdance.com added the comment:
Everything in python is an instance of something. Objects all the way down...
isinstance(object, object)
True
So, there is no function you are overlooking because there is nothing that is
not an instance.
--
nosy:
Joesph someone...@gmail.com added the comment:
It only fails when checking for 'object'. To think classes are instances is
absurd. Its like saying the chicken is the egg. I can understand that
classes are an instance of object in the interpreter, but, that isn't the
case in the interpreted. Thus
R. David Murray rdmur...@bitdance.com added the comment:
You are correct, B is not an instance of A. But both B and A are instances of
'type':
class A:
... pass
...
class B(A):
...pass
...
isinstance(A, type)
True
isinstance(B, type)
True
And type is a subclass of object.
Joesph someone...@gmail.com added the comment:
Beautiful, thank you. This should be in the isinstance documentation for
clarity.
On May 29, 2011 9:28 PM, R. David Murray rep...@bugs.python.org wrote:
R. David Murray rdmur...@bitdance.com added the comment:
You are correct, B is not an
New submission from Joesph someone...@gmail.com:
#Example:
class a(object):
pass
b = a()
print([isinstance(a,object), isinstance(b,object)])
'''
outputs: [True, True]
expected: [False, True]
As class a is not instantiated it should return false. As-is isinstance is just
a synonym for
Alex Gaynor alex.gay...@gmail.com added the comment:
I don't see why this is incorrect, type(a) - type, and object is a superclass
of type.
--
nosy: +alex
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12203
Benjamin Peterson benja...@python.org added the comment:
Everything is an instance of object.
--
nosy: +benjamin.peterson
resolution: - invalid
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12203