Can anyone help me in understanding what is the use of plus(+) sign in using isinstance.
In [76]: isinstance('qwert', string)
Out[76]: True
In [77]: isinstance('qwert', string + (int,))
Out[77]: True
Especially, this part--> string + (int,)
Can anyone help me in understanding what is the use of plus(+) sign in using isinstance.
In [76]: isinstance('qwert', string)
Out[76]: True
In [77]: isinstance('qwert', string + (int,))
Out[77]: True
Especially, this part--> string + (int,)
Assuming that your variable string_types
is itself a tuple of string types (e.g. (str, bytes,)
), the +
operator is concatenating the string_types
tuple and the (int,)
tuple together into something like (str, bytes, int,)