Skip to content

Commit

Permalink
fix range and irange compat
Browse files Browse the repository at this point in the history
  • Loading branch information
zdimension committed May 8, 2018
1 parent 49b0c1d commit 9192ee4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/maths/lib/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,14 @@ def swap(T, a, b):
("step", "Number", None, 1)
],
translate("Docs", "Generates a list containing all number from {{start}} (inclusive) to {{end}} (exclusive) with a step of {{step}}."))
translate("Docs",
"Generates a list containing all number from {{start}} (inclusive) to {{end}} (exclusive) with a step of {{step}}."))


def range(start, end, step=None):
def range(start, end=None, step=None):
if end is None:
end = start
start = 0
if step is None:
if end < start:
step = -1
Expand All @@ -517,10 +522,14 @@ def range(start, end, step=None):
("end", "Number"),
("step", "Number", None, 1)
],
translate("Docs", "Generates a list containing all number from {{start}} (inclusive) to {{end}} (inclusive) with a step of {{step}}."))
translate("Docs",
"Generates a list containing all number from {{start}} (inclusive) to {{end}} (inclusive) with a step of {{step}}."))


def irange(start, end, step=None):
def irange(start, end=None, step=None):
if end is None:
end = start
start = 0
if step is None:
if end < start:
step = -1
Expand Down

0 comments on commit 9192ee4

Please sign in to comment.