Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlei committed Oct 13, 2014
1 parent 27f718a commit 15f1e35
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion smop/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,14 @@ def isequal_(a,b):
return np.array_equal(np.asanyarray(a),
np.asanyarray(b))

def isscalar_(a)
"""np.isscalar returns True if a.__class__ is a scalar
type (i.e., int, and also immutable containers str and
tuple, but not list.) Our requirements are different"""
try:
return a.size == 1
except AttributeError:
return np.isscalar(a)

def length_(a):
try:
Expand Down Expand Up @@ -609,4 +617,4 @@ def zeros_(*args,**kwargs):
import doctest
doctest.testmod()

# vim:et:sw=4:si:
# vim:et:sw=4:si:tw=60

0 comments on commit 15f1e35

Please sign in to comment.