Skip to content

BUG: np.int_ and np.intc / np.longlong have the same __name__ but are different #9799

@drhagen

Description

@drhagen

On windows 7:

>>> np.cint, np.cint is np.int32
(numpy.int32, False)
>>> np.int_, np.int_ is np.int32
(numpy.int32, True)

On 64-bit linux:

>>> np.int_, np.int_ is np.int64
(numpy.int64, True)
>>> np.longlong, np.longlong is np.int64
(numpy.int64, False)

(original title: intc displays wrong class name)

The string representation of numpy.intc is <class 'numpy.int32'>. This would fine if this were true--just a name pointing to the same object. But at least on Windows 7, numpy.intc is not the same object as numpy.int32; it's not even a subclass. This is very confusing for debugging objects of this type, as objects inexplicably fail an isinstance test.

Could one of these two small changes be made:

  • Either make intc just be another name pointing to the object behind int32
  • Or make intc print out <class 'numpy.intc'>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions