Content-Length: 291431 | pFad | http://github.com/numpy/numpy/commit/dd6fc43e9c7398c60c330bb17a312e364196a4c9

08 MNT: Prefer isinstance over type comparison · numpy/numpy@dd6fc43 · GitHub
Skip to content

Commit dd6fc43

Browse files
MNT: Prefer isinstance over type comparison
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
1 parent 969e19e commit dd6fc43

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

numpy/_core/memmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def __new__(subtype, filename, dtype=uint8, mode='r+', offset=0,
250250
size = bytes // _dbytes
251251
shape = (size,)
252252
else:
253-
if type(shape) not in (tuple, list):
253+
if not isinstance(shape, (tuple, list)):
254254
try:
255255
shape = [operator.index(shape)]
256256
except TypeError:

numpy/lib/_shape_base_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def expand_dims(a, axis):
589589
else:
590590
a = asanyarray(a)
591591

592-
if type(axis) not in (tuple, list):
592+
if not isinstance(axis, (tuple, list)):
593593
axis = (axis,)
594594

595595
out_ndim = len(axis) + a.ndim

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/numpy/numpy/commit/dd6fc43e9c7398c60c330bb17a312e364196a4c9

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy