aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/algorithms/impl/selection_sort.py
diff options
context:
space:
mode:
Diffstat (limited to 'algorithms/impl/selection_sort.py')
-rw-r--r--algorithms/impl/selection_sort.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/algorithms/impl/selection_sort.py b/algorithms/impl/selection_sort.py
index 0dbf4eb..ad4a420 100644
--- a/algorithms/impl/selection_sort.py
+++ b/algorithms/impl/selection_sort.py
@@ -21,10 +21,12 @@ _ALGORITHMS = [
SortingAlgorithm('selection_sort', 'Selection sort', selection_sort),
]
-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(selection_sort(list(xs)))