range-Funktion

Ziffern 1 bis 10 als Liste

liste = range(1,10)
print(liste)
for i in liste:
    print(i, end=', ')

>>> 1, 2, 3, 4, 5, 6, 7, 8, 9,

Großbuchstaben als Liste

import string

for buchstabe in string.ascii_uppercase:
    print(buchstabe, end=', ')

>>> A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,

Vergleiche mit …

TypeScript
function range(_p: number, _t?: number, _s?: number): Array<number> {
/**
  * @param <_p> Return a list integers of zero until <_p> value.
  * @param <_t> Return a list integers of <_t> until <_p> value.
  * @param <_s> Return a list integers of <_t> until <_p> with steps <_s> value.
  * @return Return a array list
  */

let start: number = (_t) ? _p : 0;
let stop: number = (_t) ? _t : _p;
let step: number = (_s) ? _s : 1;

let t: Array<number> = [];
for (let i = start; i < stop; i=i+step) {
  t.push(i);
}

  return t;
}

/*
 * range(10)
 * range(7, 10)
 * range(0, 10, 2)
 */

https://gist.github.com/gutierri/a0d8972a29dfc0a9a559fb7f88d8f409
Rust
struct SimpleStepRange(isize, isize, isize);  // start, end, and step

impl Iterator for SimpleStepRange {
    type Item = isize;

    #[inline]
    fn next(&mut self) -> Option<isize> {
        if self.0 < self.1 {
            let v = self.0;
            self.0 = v + self.2;
            Some(v)
        } else {
            None
        }
    }
}

fn main() {
    for i in SimpleStepRange(0, 10, 2) {
        println!("{}", i);
    }
}
https://doc.rust-lang.org/std/ops/struct.Range.html
https://stackoverflow.com/questions/27893223/how-do-i-iterate-over-a-range-with-a-custom-step