aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/algorithms/impl/bubble_sort.py
diff options
context:
space:
mode:
Diffstat (limited to 'algorithms/impl/bubble_sort.py')
-rw-r--r--algorithms/impl/bubble_sort.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/algorithms/impl/bubble_sort.py b/algorithms/impl/bubble_sort.py
index e75ceab..95fb661 100644
--- a/algorithms/impl/bubble_sort.py
+++ b/algorithms/impl/bubble_sort.py
@@ -36,10 +36,12 @@ _ALGORITHMS = [
SortingAlgorithm('bubble_sort_optimized', 'Bubble sort (optimized)', bubble_sort_optimized),
]
-def _parse_args(args=sys.argv):
- return list(map(int, args[1:]))
+def _parse_args(args=None):
+ if args is None:
+ args = sys.argv[1:]
+ return list(map(int, args))
-def main(args=sys.argv):
+def main(args=None):
xs = _parse_args(args)
print(bubble_sort(list(xs)))
print(bubble_sort_optimized(list(xs)))