Skip to main content

py_range

Function py_range 

Source
pub fn py_range(start: i64, stop: i64, step: i64) -> Vec<i64>
Expand description

Python’s range(start, stop, step), which the tick rules count with.

use music21::graph::py_range;

assert_eq!(py_range(0, 10, 4), vec![0, 4, 8]);
assert_eq!(py_range(5, 0, -2), vec![5, 3, 1]);
assert!(py_range(0, 10, -1).is_empty());

§Panics

Never; a step of nought gives nothing, where Python raises.