I have an array that contains several type of dict, as example:
arr = [
{'type': 'employee.update', ...},
{'type': 'job.started', ...},
{'type': 'meeting.xpto', ...}
...
]
How can I split the "main" array by prefix of type? Is necessary to iterate over entire array for every prefix?
employess_actions = list(filter(lambda x: x['type'].startswith('employee.'), arr))
job_actions = list(filter(lambda x: x['type'].startswith('job.'), arr))
meeting_actions = list(filter(lambda x: x['type'].startswith('meeting.'), arr))
Is there any performatic way of achieve it? Or a pythonic way.
arr?