Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from builtins import * introduces suble bugs #197

Open
g4b1nagy opened this issue Feb 17, 2016 · 1 comment
Open

from builtins import * introduces suble bugs #197

g4b1nagy opened this issue Feb 17, 2016 · 1 comment

Comments

@g4b1nagy
Copy link

Consider the following code, running on Python 2.7.6:

>>> from builtins import *
>>> l = [1,2,3]
>>> type(l) is list
False

Edit: this also happens if you use from builtins import str:

>>> from builtins import str
>>> s = 'foo'
>>> type(str) is str
False

I would suggest adding a warning regarding the type() function when using builtins and providing isinstance() as an alternative.

@aaronchall
Copy link

Since isinstance is the general guidance for all Python type-checking, I don't think a special warning is warranted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants