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

Make import checks more explicit in %whos #910

Merged
merged 2 commits into from Oct 25, 2011
Merged

Conversation

minrk
Copy link
Member

@minrk minrk commented Oct 20, 2011

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

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
@takluyver
Copy link
Member

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.

@minrk
Copy link
Member Author

minrk commented Oct 20, 2011

lol, good point. I think it's perfectly fine to drop support for pretty-printed Numeric arrays in %whos.

@minrk
Copy link
Member Author

minrk commented Oct 20, 2011

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]:
Copy link
Member

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.

@takluyver
Copy link
Member

Other than that, it looks fine (I assume you've run it on PyPy)

@minrk
Copy link
Member Author

minrk commented Oct 20, 2011

comment addressed.

And yes, I have run it on pypy, and also in CPython with a dummy numpy.py that prevents numpy from making any sense.

@fperez
Copy link
Member

fperez commented Oct 21, 2011

+1 from me. Guys, I'm really offline starting tomorrow, so go ahead without me on this one...

minrk added a commit that referenced this pull request Oct 25, 2011
%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
@minrk minrk merged commit 4c90e86 into ipython:master Oct 25, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
%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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

whos under pypy1.6
3 participants