List ยป items

items โ†’ list
items(options) โ†’ list
items(loader, options) โ†’ list

Retrieve the items of the list, optionally passing them through a loader.

enocolors:
- pink
- peach
python>>> document = enopy.parse(input)
>>> list = document.element('colors')

>>> list.items()
['pink', 'peach']

>>> list.items(lambda name, value: f"{value}!!")
['pink!!', 'peach!!']

Parameters

loader

A function returning the transformed/validated value or raising an error.(The function is applied to each list item on its own, being passed thearguments name and value, in that order, or just value if your loaderonly takes a single parameter.

options

elements

Whether to return the elements (as Field) instead of the values of the list items. (defaults to False)

enforce_values

Whether empty list items (- in the document, mapping to None) are disallowed (defaults to True)

with_elements

Whether to return a list of lists of the form [element, value] instead of just the values (defaults to False)

Return value

The (optionally transformed/validated) items of this list as a list.