Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Attempt to fix issue #4701, np.asscalar should pass through scalars
  • Loading branch information
seawolf631 committed Dec 22, 2017
commit 68c57a0da04858211311a6a8d50d99f2fa571870
5 changes: 4 additions & 1 deletion numpy/lib/type_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,10 @@ def asscalar(a):
24

"""
return a.item()
try:
return a.item()
except AttributeError, e:
Copy link
Member

Choose a reason for hiding this comment

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

Deprecated syntax, just use except AttributeError

return np.asarray(a).item()

#-----------------------------------------------------------------------------

Expand Down