MCPcopy Index your code
hub / github.com/geekcomputers/Python / __str__

Method __str__

linear-algebra-python/src/lib.py:66–79  ·  view source on GitHub ↗

returns a string representation of the vector

(self)

Source from the content-addressed store, hash-verified

64 raise Exception("please give any vector")
65
66 def __str__(self):
67 """
68 returns a string representation of the vector
69 """
70 ans = "("
71 length = len(self.__components)
72 for i in range(length):
73 if i != length - 1:
74 ans += str(self.__components[i]) + ","
75 else:
76 ans += str(self.__components[i]) + ")"
77 if len(ans) == 1:
78 ans += ")"
79 return ans
80
81 def component(self, i):
82 """

Callers 11

test_strMethod · 0.95
test_copyMethod · 0.95
test_changeComponentMethod · 0.95
test_mulMethod · 0.45
test_zeroVectorMethod · 0.45
test_unitBasisVectorMethod · 0.45
test_axpyMethod · 0.45
test__mul__matrixMethod · 0.45
test__add__matrixMethod · 0.45
test__sub__matrixMethod · 0.45
test_squareZeroMatrixMethod · 0.45

Calls

no outgoing calls

Tested by 11

test_strMethod · 0.76
test_copyMethod · 0.76
test_changeComponentMethod · 0.76
test_mulMethod · 0.36
test_zeroVectorMethod · 0.36
test_unitBasisVectorMethod · 0.36
test_axpyMethod · 0.36
test__mul__matrixMethod · 0.36
test__add__matrixMethod · 0.36
test__sub__matrixMethod · 0.36
test_squareZeroMatrixMethod · 0.36