Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing all type() to _check_type() #197

Merged
merged 3 commits into from
Mar 22, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pydatastructs/linear_data_structures/arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ def __new__(cls, dtype=NoneType, *args, **kwargs):
if _check_type(args[0], list) and \
_check_type(args[1], int):
for i in range(len(args[0])):
if dtype != type(args[0][i]):
if dtype != _check_type(args[0][i]):
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved
args[0][i] = dtype(args[0][i])
size, data = args[1], [arg for arg in args[0]]
elif _check_type(args[1], list) and \
_check_type(args[0], int):
for i in range(len(args[1])):
if dtype != type(args[1][i]):
if dtype != _check_type(args[1][i]):
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved
args[1][i] = dtype(args[1][i])
size, data = args[0], [arg for arg in args[1]]
else:
Expand All @@ -99,7 +99,7 @@ def __new__(cls, dtype=NoneType, *args, **kwargs):
obj._data = [init for i in range(args[0])]
elif _check_type(args[0], (list, tuple)):
for i in range(len(args[0])):
if dtype != type(args[0][i]):
if dtype != _check_type(args[0][i]):
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved
args[0][i] = dtype(args[0][i])
obj._size, obj._data = len(args[0]), \
[arg for arg in args[0]]
Expand All @@ -118,7 +118,7 @@ def __setitem__(self, idx, elem):
if elem is None:
self._data[idx] = None
else:
if type(elem) != self._dtype:
if _check_type(elem) != self._dtype:
czgdp1807 marked this conversation as resolved.
Show resolved Hide resolved
elem = self._dtype(elem)
self._data[idx] = elem

Expand Down