do I need to list each item to iterate over?
No - Enum classes are iterables, each value has attributes .name and .value, so you can filter on either as you see fit. For example:
for v in Items:
if v.value > 3:
break
print(v.name, v.value)
=>
item1 0
item2 1
item3 2
item4 3
is there a shortcut?
Depends on what you want to do. Here are a few ways you could use the fact that Enums are iterables:
sorted(Items, key=lambda v: v.value)[:4] => get the first 4 elements as sorted by their ordinal value
filter(lambda e: e.value < 5, Items) => get all items with an ordinal value < 5
{v.name: v.value for v in Items if v.value < 4} => get a dictionary of all name/value pairs given a filter
etc.
Note
According to the documentation you can get the Enums ordered dictionary by Items.__members__ and thus you could use .items on that to get the key/value mappings. However what you get as the value (in the dictionary) is in fact an object instance that has the .name and .value attributes.
Items.__members__
=>
mappingproxy({'item1': <Items.item1: 0>,
'item2': <Items.item2: 1>,
'item3': <Items.item3: 2>,
'item4': <Items.item4: 3>)
# so you could write
for k, v in Items.__members__.items():
if v > 3:
break
print(k, v.value)
However I find the first method more intuitive.
itertools.isliceperhaps:for item in islice(Items, 4)