Skip to main content
Code Review

Return to Revisions

6 of 6
replaced http://stackoverflow.com/ with https://stackoverflow.com/

There are some things, which can be improved.

For one, the weave method can be rewritten using itertools, see this SO post for examples. The idea is to combine elements via iterators (with function similar to zip - see izip_longest), chain and filter out Nones, which were possibly added from missing counterparts.

Then, this pattern:

rows = []
for i in range(len(splits_bestand)):
 rows += [CoordinateRow(splits_bestand[i].split())] 

can be replaced with more compact comprehension:

rows = [CoordinateRow(sb.split()) for sb in splits_bestand]

Also, Python list has extend method, which can be used directly in .extend method, like: self.row.extend(row). Similarly for append method. If you will need those at all after using itertools.

Code for previous raw can also be easily rewritten with itertools. Left as an exercise.

Roman Susi
  • 973
  • 8
  • 11
default

AltStyle によって変換されたページ (->オリジナル) /