MCPcopy Index your code
hub / github.com/python/cpython / isnum

Function isnum

Lib/test/test_binop.py:17–22  ·  view source on GitHub ↗

Test whether an object is an instance of a built-in numeric type.

(x)

Source from the content-addressed store, hash-verified

15 return isinstance(x, int)
16
17def isnum(x):
18 """Test whether an object is an instance of a built-in numeric type."""
19 for T in int, float, complex:
20 if isinstance(x, T):
21 return 1
22 return 0
23
24def isRat(x):
25 """Test whether an object is an instance of the Rat class."""

Callers 7

__add__Method · 0.85
__sub__Method · 0.85
__rsub__Method · 0.85
__mul__Method · 0.85
__truediv__Method · 0.85
__rtruediv__Method · 0.85
__eq__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…