================
@@ -58,19 +58,19 @@ def csv_to_json_dict(csv_filepath):
json.dumps({}, indent=2)
return
- other_column_names = [name.strip() for name in header[1:]]
+ header_length = len(header)
data_dict = {}
for row in reader:
- if len(row) != len(header):
+ if len(row) != header_length:
raise csv.Error("Inconsistent CSV file")
exit(1)
key = row[0]
value_map = {}
- for i, col_name in enumerate(other_column_names):
+ for i, col_name in enumerate(header[1:]):
----------------
necto wrote:
While the previous hoisting makes sense, why did you undo the hoisting here?
Apparently slicing creates a copy of the list, which is arguably more expensive
than reading its length
https://github.com/llvm/llvm-project/pull/161665
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits