def is_scalar(obj):
    """
    Returns :samp:`True` if argument :samp:`{obj}` is
    a numeric type.

    :type obj: :obj:`object`
    :param obj: Return :samp:`True` if this is a scalar.
    :rtype: :obj:`bool`
    :return: :samp:`True` if :samp:`{obj}` is a numeric scalar.

    Example::

       >>> is_scalar(5)
       True
       >>> is_scalar(2.0)
       True
       >>> import numpy as np
       >>> is_scalar(np.ones((10,), dtype="uint16")[0])
       True
       >>> is_scalar([1, 2, 3])
       False
       >>> is_scalar([i for i in range(0, 3)])
       False

    """
    return hasattr(obj, '__int__') or hasattr(obj, '__long__')
