Saturday, 10 August 2013

#EANF#

#EANF#

I have a list that looks like
alist = [a, b, c, d, e]
and I want to pass it to a function that looks like
def callme(a, b, e):
pass
So, I would like to do something like
callme(*alist[0,1,4])
Is there a one liner that will achieve this?
EDIT
I could also do this, I guess:
callme(*[a for a in alist if a in [0,1,4]])

No comments:

Post a Comment