Re:Grumpy: Go running Python
by trotterdylan on Wednesday January 04, 2017 @05:55PM
(#13322902)
Ugh, sorry about that. There's a couple issues here:
1. Lambda tuple args are not yet supported -- I actually didn't know that was a thing :\ -- https://github.com/google/grumpy/issues/17
2. Even if that worked properly, sorted() is not yet implemented: https://github.com/google/grumpy/issues/16
Re:Grumpy: Go running Python
by justinsaccount on Wednesday January 04, 2017 @06:22PM
(#13323089)
Yeah.. It also used to work with def, but it was removed in python3. You can do this in 2.7:
def func((a,b)):
return b
mytuple = 1,2
print func(mytuple)
in py3 you need def func(t):
a,b = t
return b
Not sure ifThis is probably the cleaner way to write that:
key=operator.itemgetter(1)
I managed to run into 2 trying to build a 5 line program :-)