music.GenericPeal

class music.GenericPeal[source]

Bases: object

A collection of named peals that can be acted on a domain.

The base for the named-peal model: peals maps a name to a list of permutations, and act applies one of them by name. Peals works that way and inherits this.

music.PlainChanges deliberately does not. It is built from one peal rather than holding several, so its act acts that peal and takes the domain first – act(domain) rather than act(name, domain). The two are different operations that happen to share a verb.

Attributes:
nelementsint

The number of elements in the domain.

pealsdict

A dictionary containing the peals and their corresponding actions.

acted_pealsdict

A dictionary containing the acted peals and their results.

domainlist

The domain on which the peals are acted.

Methods

act(peal[, domain])

Acts a specific peal on the specified domain.

act_all([domain])

Acts all peals on the specified domain.

__init__()[source]

Initializes a GenericPeal object.

Methods

__init__()

Initializes a GenericPeal object.

act(peal[, domain])

Acts a specific peal on the specified domain.

act_all([domain])

Acts all peals on the specified domain.

Attributes

peals

name -> list of permutations.

acted_peals

peals: dict

name -> list of permutations. Empty rather than None: a collection with nothing in it is what an unpopulated one is, and act() refuses to run on either.

acted_peals: dict
act(peal, domain=None)[source]

Acts a specific peal on the specified domain.

Parameters:
pealstr

The name of the peal to act.

domainlist, optional

The domain on which to act the peal. Defaults to None.

Returns:
list

The result of acting the peal on the specified domain.

act_all(domain=None)[source]

Acts all peals on the specified domain.

Parameters:
domainlist, optional

The domain on which to act the peals. Defaults to None.