Jl2Py

Documentation for Jl2Py.

Jl2Py.__parse_rangeMethod

Parse a Julia range (leading by :(:)).

We modify the end when all args are Integers. For example:

  • 1:3 becomes range(1, 4)
  • 1:5:11 becomes range(1, 12, 5)
  • 1:-5:-9 becomes range(1, -10, -5)

We also modify the end when the step is implicit (=1). For example:

  • a:b becomes range(a, b + 1)

This might cause problems in such cases as 1.5:1.8, but since Python only supports integer-indexed implicit ranges, we do not consider such edge cases here.

source