Skip to content

Commit 1ea22c1

Browse files
author
Clemens Mandl
committed
Updated List comparision with shorter implementaion using python build-in function zip()
1 parent 8bb35ca commit 1ea22c1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tools/export/nb/__init__.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,10 @@ def get_netbeans_file_list(file_list):
326326
# evaluate all matched items (from current and previous list)
327327
matched = []
328328
# Compare the Element in Previous Dir with the Elements in Current Dir
329-
# and add the Differences to the match-List
330-
if len(dir_list) <= len(prev_dir_list):
331-
for idx, element in enumerate(dir_list):
332-
if element == prev_dir_list[idx]:
333-
matched.append(element)
334-
else:
335-
for idx, element in enumerate(prev_dir_list):
336-
if element == dir_list[idx]:
337-
matched.append(element)
329+
# and add the equal Elements to the match-List
330+
for elem_prev_dir, elem_cur_dir in zip(prev_dir_list, dir_list):
331+
if elem_prev_dir == elem_cur_dir:
332+
matched.append(elem_cur_dir)
338333

339334
# calculate difference between matched and length
340335
diff = dir_depth - len(matched)

0 commit comments

Comments
 (0)