0

Ok I've been searching for about an hour now to no avail. I am trying to mimic the following code in a list comprehension.

b= []
for i in [{'a': 1, 'b': 2, 'c': 3}, {'d': 4, 'e': 5, 'f': 6}]:
    b.append(cls.somefunc(**i))

I want to create a list of the returned values from somefunc with the unpacked dictionary as arguments.

b = [cls.somefunc() for i in [{'a': 1, 'b': 2, 'c': 3}, {'d': 4, 'e': 5, 'f': 6}]

This was as close as I got. This sends each dictionary as an argument in my list to somefunc but I want each key/value pair to be passed as an argument instead of the dictionary

cls.somefunc(a=1, b=2, c=3)

I'm open to using map or lambda if it's required.

Vilyanare
  • 44
  • 2

0 Answers0