File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed
Data Science from Scratch Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change @@ -20,26 +20,13 @@ def data(self, value):
2020 self ._data = value
2121
2222 def __repr__ (self ):
23- def my_format (x ):
24- if type (x ) == bool :
25- return str (x )
26- else :
27- return '{}' .format (round (x , 6 ))
28-
29- if len (self ) > 10 :
30- string = ', ' .join (my_format (x ) for x in self .data [:5 ]) + \
31- ' ..., ' + \
32- ', ' .join (my_format (x ) for x in self .data [- 5 :])
33- else :
34- string = ', ' .join (my_format (x ) for x in self .data )
35- return 'Array1D([' + string + '])'
23+ return 'Array1D(' + repr (self .data ) + ')'
3624
3725 def __len__ (self ):
3826 return len (self .data )
3927
4028 def __iter__ (self ):
41- for d in self .data :
42- yield d
29+ return iter (self .data )
4330
4431 def __getitem__ (self , index ):
4532 if type (index ) == int :
You can’t perform that action at this time.
0 commit comments