src/pylib/builtins/pyrange

Source   Edit  

Types

PyRange[T] = ref object
  start*, stop*: T           ## `start`, `stop`, `step` are exported since Python 3.3
  step*, len: int
Python-like range object Source   Edit  

Procs

func `$`[T](rng: PyRange[T]): string
Source   Edit  
func `[]`[T](x: PyRange[T]; y: Natural): T {.inline.}
Get value from range by its index Source   Edit  
func contains[T](x: PyRange[T]; y: T): bool
Checks if given value is in range Source   Edit  
func count[T](r: PyRange[T]; x: T): int
Source   Edit  
func index[T](r: PyRange[T]; x: T): int
Source   Edit  
func max[T](x: PyRange[T]): T {.inline.}
Get maximum value from range. Python's max(range(...)) Source   Edit  
func min[T](x: PyRange[T]): T {.inline.}
Get minimum value from range. Python's max(range(...)) Source   Edit  
func range[T: SomeInteger](start, stop, step: T): PyRange[T]
Creates new range object with given start, stop and step of any integer type Source   Edit  
func repr[T](rng: PyRange[T]): string
Source   Edit  

Iterators

iterator items[T](rng: PyRange[T]): T
Source   Edit  

Templates

template len[T](rng: PyRange[T]): int
Source   Edit  
template range[T: SomeInteger](start, stop: T): PyRange[T]
Shortcut for range(start, stop, 1) Source   Edit  
template range[T: SomeInteger](stop: T): PyRange[T]
Shortcut for range(0, stop, 1) Source   Edit