psychopy_ext.exp.combinations

psychopy_ext.exp.combinations(iterable, r)[source]

Produces combinations of iterable elements of lenght r.

Examples:
  • combinations(‘ABCD’, 2) –> AB AC AD BC BD CD
  • combinations(range(4), 3) –> 012 013 023 123

From Python 2.6 docs under the Python Software Foundation License

Args:
  • iterable

    A list-like or a str-like object that contains some elements

  • r

    Number of elements in each ouput combination

Returns:

A generator yielding combinations of lenght r