[issue12203] isinstance not functioning as documented

2011-05-29 Thread Joesph
Joesph 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" wrote: > > R. David Murray added the comment: > > You are correct, B is not an instance of A. But both B and A are instances of 'type': >

[issue12203] isinstance not functioning as documented

2011-05-29 Thread R. David Murray
R. David Murray 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. isinstance is

[issue12203] isinstance not functioning as documented

2011-05-29 Thread Joesph
Joesph 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 this is an unhandled

[issue12203] isinstance not functioning as documented

2011-05-29 Thread R. David Murray
R. David Murray 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: +r.david.murray _

[issue12203] isinstance not functioning as documented

2011-05-29 Thread Joesph
Joesph 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 6:19 PM, "Benjamin Peter

[issue12203] isinstance not functioning as documented

2011-05-28 Thread Benjamin Peterson
Benjamin Peterson added the comment: Everything is an instance of object. -- nosy: +benjamin.peterson resolution: -> invalid status: open -> closed ___ Python tracker ___ _

[issue12203] isinstance not functioning as documented

2011-05-28 Thread Alex Gaynor
Alex Gaynor 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 ___ ___

[issue12203] isinstance not functioning as documented

2011-05-28 Thread Joesph
New submission from Joesph : #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 issubclass. ''' --