numpy / numpy-stubs

Experimental typing stubs for NumPy
BSD 3-Clause "New" or "Revised" License
282 stars 32 forks source link

Support comparison operators for dtype #82

Closed unnonouno closed 4 years ago

unnonouno commented 4 years ago

I sometimes want to check dtype like this:

assert x.dtype == "f"

Based on the source code, all comparison operators support DtypeLike. https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/descriptor.c#L3167

unnonouno commented 4 years ago

Thank you for a comment. Sure. I'll add some tests to simple.py and check the test.

unnonouno commented 4 years ago

I wrote brief test cases which covers all comparison operators. Is it enough? I also can check all combination of operators and types in dtypelike (too much?).

person142 commented 4 years ago

Thanks @unnonouno.

unnonouno commented 4 years ago

Thank you!!