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 this is an unhandled case.
To accept your answer would mean it is a pointless function that should be
removed altogether. But that is not the case as this example works as
expected:
class A(object):
pass
class B(A):
pass
C = B()
print([isinstance(B,A),isinstance(C,A)])
# outputs: [False, True]
You did make it obvious to me why the object case was failing and for that I
am grateful. It will make it easier to work around when I get back to that
part of the code.
On Sun, May 29, 2011 at 7:14 PM, R. David Murray <rep...@bugs.python.org>wrote:
>
> 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: +r.david.murray
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue12203>
> _______________________________________
>
----------
Added file: http://bugs.python.org/file22185/unnamed
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12203>
_______________________________________
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 case. <br>
<br>To accept your answer would mean it is a pointless function that should be
removed altogether. But that is not the case as this example works as
expected:<br><br>class A(object):<br>Â Â Â pass<br><br>class B(A):<br>Â Â Â
pass<br>
<br>C = B()<br><br>print([isinstance(B,A),isinstance(C,A)])<br><br># outputs:
[False, True]<br><br>You did make it obvious to me why the object case was
failing and for that I am grateful. It will make it easier to work around when
I get back to that part of the code.<br>
<br><div class="gmail_quote">On Sun, May 29, 2011 at 7:14 PM, R. David Murray
<span dir="ltr"><<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>></span>
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
R. David Murray <<a
href="mailto:rdmur...@bitdance.com">rdmur...@bitdance.com</a>> added the
comment:<br>
<br>
Everything in python is an instance of something. Â Objects all the way
down...<br>
<br>
>>> isinstance(object, object)<br>
True<br>
<br>
So, there is no function you are overlooking because there is nothing that is
not an instance.<br>
<br>
----------<br>
nosy: +r.david.murray<br>
<div><div></div><div class="h5"><br>
_______________________________________<br>
Python tracker <<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>><br>
<<a href="http://bugs.python.org/issue12203"
target="_blank">http://bugs.python.org/issue12203</a>><br>
_______________________________________<br>
</div></div></blockquote></div><br><div style="visibility: hidden; left:
-5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px;
margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black;
font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com