mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-08 03:54:26 +08:00
clean of unnecessary checks, imports, calls (#7993)
This commit is contained in:
@ -129,7 +129,7 @@ class Vector:
|
||||
input: index (0-indexed)
|
||||
output: the i-th component of the vector.
|
||||
"""
|
||||
if type(i) is int and -len(self.__components) <= i < len(self.__components):
|
||||
if isinstance(i, int) and -len(self.__components) <= i < len(self.__components):
|
||||
return self.__components[i]
|
||||
else:
|
||||
raise Exception("index out of range")
|
||||
|
Reference in New Issue
Block a user