Author eric.araujo
Recipients eric.araujo, ezio.melotti, flox, georg.brandl, michael.foord, rhettinger
Date 2011-11-12.15:32:20
SpamBayes Score 5.82816e-08
Marked as misclassified No
Message-id <1321111941.5.0.993176570822.issue13387@psf.upfronthosting.co.za>
In-reply-to
Content
>I would say that this one is clear too:
>  aelf.assertTrue(isinstance(obj, cls))
> except that the failure message is not very friendly:
>  AssertionError: False is not true
Yeah, you have to give something as third argument to ease debugging.

> If we keep assertIsInstance, more people will continue to misuse it just because the
> method exist, when they really want to check (type(obj) is cls).
If they make that mistake, it is because they don’t understand what isinstance does.

> An option could be to add a snippet to the documentation of `assertIsInstance` stating
> that the right way to check exact type is `assertIs(type(obj), cls)`.
My point was that maybe they think they really want to check the type, but with Python you don’t have to care that much most of the time.

+1 on a doc addition (I can even volunteer a patch)
-0.5 on the proposed new argument
History
Date User Action Args
2011-11-12 15:32:21eric.araujosetrecipients: + eric.araujo, georg.brandl, rhettinger, ezio.melotti, michael.foord, flox
2011-11-12 15:32:21eric.araujosetmessageid: <1321111941.5.0.993176570822.issue13387@psf.upfronthosting.co.za>
2011-11-12 15:32:20eric.araujolinkissue13387 messages
2011-11-12 15:32:20eric.araujocreate