Skip to content

Pattern: PScalar

Reduce tuples and lists into single scalar values,

either by taking the mean or the first value. Empty lists are reduced to None.

Example output

>>> p = PScalar(PSequence([ 1, (2, 3), (4, 5, 6), (), 7 ], 1)
>>> p.all())
[1, 2.5, 5, None, 7]