[Tutor] isinstance versus 'is'?
joel.goldstick at gmail.com
Tue Jul 5 18:49:38 EDT 2016
On Tue, Jul 5, 2016 at 3:05 PM, Alex Hall <ahall at autodist.com> wrote:
> Hi all,
> Thanks for all the help regarding decorators. It makes more sense now.
> I was double checking that I remembered the isinstance order of arguments
> correctly by using the command line interpreter, and found something very
>>>> a = 5
>>>> isinstance(a, int)
>>>> a is int
> What happened there? Don't these do the same thing? I thought I could use
> them interchangeably?
> Alex Hall
> Automatic Distributors, IT department
> ahall at autodist.com
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
is denotes identity. 5 is not the type int. It is an int, but it is
not the same -- if it was 5('16') would be 16.
More information about the Tutor