aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/algorithms/impl/median.py
diff options
context:
space:
mode:
Diffstat (limited to 'algorithms/impl/median.py')
-rw-r--r--algorithms/impl/median.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/algorithms/impl/median.py b/algorithms/impl/median.py
index d19dec4..b48e511 100644
--- a/algorithms/impl/median.py
+++ b/algorithms/impl/median.py
@@ -47,10 +47,12 @@ _ALGORITHMS = [
Algorithm('median_heaps', 'Median value (using heaps)', calc_median_heaps),
]
-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(calc_median_sorting(list(xs)))
print(calc_median_heaps(list(xs)))