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
Make import checks more explicit in %whos #910
Conversation
Since PyPy has a fake numpy, checking for 'numpy' is insufficient only check if numpy/numeric in use, to prevent unnecessary imports closes ipythongh-904
Looks sensible. Do we actually still need to check for numeric? It's no longer even in Ubuntu/Debian repos, and the last binary installer is for Python 2.4. |
lol, good point. I think it's perfectly fine to drop support for pretty-printed Numeric arrays in |
Numeric removed |
@@ -918,7 +914,7 @@ Currently the magic system has the following functions:\n""" | |||
print vformat.format(vname, vtype, varwidth=varwidth, typewidth=typewidth), | |||
if vtype in seq_types: | |||
print "n="+str(len(var)) | |||
elif vtype in [array_type,ndarray_type]: | |||
elif vtype in [ndarray_type]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't really need the in
test now.
Other than that, it looks fine (I assume you've run it on PyPy) |
comment addressed. And yes, I have run it on pypy, and also in CPython with a dummy |
+1 from me. Guys, I'm really offline starting tomorrow, so go ahead without me on this one... |
%whos no longer imports numpy unconditionally, and no longer supports Numeric. The import check explicitly looks for the ndarray object, rather than just numpy itself, which would fail in environments with broken numpy, such as PyPy. closes gh-904
%whos no longer imports numpy unconditionally, and no longer supports Numeric. The import check explicitly looks for the ndarray object, rather than just numpy itself, which would fail in environments with broken numpy, such as PyPy. closes ipythongh-904
Since PyPy has a fake numpy, checking for 'import numpy' is insufficient
only check if numpy/numeric in use, to prevent unnecessary imports
%precision
has a similar issue, but I'm actually inclined to let it raise (it doesn't crash, or anything, just shows that numpy is not really numpy).%whos
is more important, and was entirely broken on PyPy.closes #904