les_iterables.functions module

Summary

Functions:

elements_at

Select elements from a sequence based on their indexes.

empty_iterable

extended_unchain

Convert an iterable into an infinite series of lists of containing zero or one items.

false_then_true

A single False value followed by True values.

indexes

The indexes at which item occurs in a sequence.

just

An iterable of just one item.

run_length_encode

true_then_false

A single True value followed by False values.

unchain

Reference

les_iterables.functions.just(item)[source]

An iterable of just one item.

Parameters:

item – The item to be yielded.

Yields:

The item.

les_iterables.functions.elements_at(seq, indexes)[source]

Select elements from a sequence based on their indexes.

Parameters:
  • seq – The sequence from which to select elements.

  • indexes – Indexes into seq indicating the selected elements.

Yields:

A series of items selected from seq by indexes.

Raises:

IndexError – If one of the indexes is not valid with seq.

les_iterables.functions.indexes(seq, item)[source]

The indexes at which item occurs in a sequence.

Parameters:
  • seq – A sequence in which to search for occurrences of item.

  • item – The item for which to determine indexes.

Yields:

A series of indexes into seq at which item occurs.

les_iterables.functions.unchain(iterable, box=None)[source]
les_iterables.functions.extended_unchain(iterable, box=<class 'list'>)[source]

Convert an iterable into an infinite series of lists of containing zero or one items.

les_iterables.functions.empty_iterable()[source]
les_iterables.functions.run_length_encode(items)[source]
les_iterables.functions.false_then_true()[source]

A single False value followed by True values.

les_iterables.functions.true_then_false()[source]

A single True value followed by False values.