chore: use isinstance() instead of type comparison by parthea · Pull Request #1792 · googleapis/google-api-python-client

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed weird, but is also safe.

Look at the last time it was changed (you will have to expand discover.py and scroll to line 701): 3bbefc1#diff-b039ba2bb64e79cf4c77e4fe5a4b21a826172e8b7ae9be872fd2d46047c05cbbL695-R701

Originally, it was

if type(value) == type("") or type(value) == type(u""):

But was changed automatically to be

if type(value) == type("") or type(value) == type(""):

because type("") == type(u"") == "str".

This if is redundant and pretty silly, and should be changed, no?