diff options
Diffstat (limited to 'algorithms/impl/heapsort.py')
-rw-r--r-- | algorithms/impl/heapsort.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/algorithms/impl/heapsort.py b/algorithms/impl/heapsort.py index 6615e14..bf9f464 100644 --- a/algorithms/impl/heapsort.py +++ b/algorithms/impl/heapsort.py @@ -58,10 +58,12 @@ _ALGORITHMS = [ SortingAlgorithm('heapsort', 'Heapsort', heapsort), ] -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(heapsort(list(xs))) |