Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

There are some things, which can be improved.

For one, the weave method can be rewritten using itertools, see this SO post 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.

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.

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.

added 32 characters in body
Source Link
Roman Susi
  • 973
  • 8
  • 11

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.

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.

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.

added 32 characters in body
Source Link
Roman Susi
  • 973
  • 8
  • 11

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.

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)

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.

added 23 characters in body
Source Link
Grajdeanu Alex
  • 9.3k
  • 4
  • 32
  • 71
Loading
added 81 characters in body
Source Link
Roman Susi
  • 973
  • 8
  • 11
Loading
Source Link
Roman Susi
  • 973
  • 8
  • 11
Loading
lang-py

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