On Sat, Oct 27, 2018 at 10:00 PM Chris Angelico wrote:
> On Sun, Oct 28, 2018 at 12:53 PM Joy Diamond wrote:
> >> - type(x) and x.__class__ don't necessarily agree; under what
> >> circumstances are each used?
> >>
> >> (I've asked this before, and either never got a good answer, or I can't
>
On Sun, Oct 28, 2018 at 12:53 PM Joy Diamond wrote:
>> - type(x) and x.__class__ don't necessarily agree; under what
>> circumstances are each used?
>>
>> (I've asked this before, and either never got a good answer, or I can't
>> keep it straight in my head.)
>>
>> - what precisely does type(x)
On Sat, Oct 27, 2018 at 8:02 PM Steven D'Aprano wrote:
> I don't think it is obvious that the behaviour is correct. Presumably
> Joy had a use-case for overriding isinstance(), and this optimization
> prevented it.
>
> Joy, can you comment on your use-case, and did you come up with a
>
On Sun, Oct 28, 2018 at 11:02 AM Steven D'Aprano wrote:
> > """
> > (Note that any object `x` is always considered to be an instance of
> > `x.__class__`, and this cannot be overridden.)
> > """
>
> I would rather be precise about what is going on, and state that
> X.__instancecheck__(x) is not
On Sun, Oct 28, 2018 at 05:24:43AM +1100, Chris Angelico wrote:
> On Sun, Oct 28, 2018 at 5:03 AM Joy Diamond wrote:
> > NOTE: As an optimization, isinstance(object, classinfo) does NOT
> > call classinfo.__instancecheck__(instance) when type(object) ==
> > classinfo.
I'd like to discuss this
Thanks, Terry.
As per your suggestion, I have submitted it as a bug report to:
https://bugs.python.org/issue35083
On Sat, Oct 27, 2018 at 4:09 PM Terry Reedy wrote:
> On 10/27/2018 2:53 PM, Joy Diamond wrote:
> > Chris,
> >
> > Yes, the following works:
> > """
> > (Note that any object `x` is
On 10/27/2018 2:53 PM, Joy Diamond wrote:
Chris,
Yes, the following works:
"""
(Note that any object `x` is always considered to be an instance of
`type(x)`, and this cannot be overridden.)
"""
Open a doc issue on bugs.python.org with the problem, motivation, and
proposed solution and it
Chris,
Yes, the following works:
"""
(Note that any object `x` is always considered to be an instance of
`type(x)`, and this cannot be overridden.)
"""
NOTE: I fixed your sentence of `x.__class__` to `type(x)` since it is not
always true that `x.__class__ == type(x)`.
For example the actual
On Sun, Oct 28, 2018 at 5:03 AM Joy Diamond wrote:
>
> Greetings,
>
> This is a request to fix the documentation for __instancecheck__.
>
> Please add the following (please rewrite better than I can -- I am not good
> at explaining concepts in short sentences):
>
> NOTE: As an optimization,
Greetings,
This is a request to fix the documentation for __instancecheck__.
Please add the following (please rewrite better than I can -- I am not good
at explaining concepts in short sentences):
NOTE: As an optimization, isinstance(*object*, *classinfo*) does NOT call
10 matches
Mail list logo