Reputation: 1
class Test:
def generate_attachment(self, type, owner_id, media_id):
return type + str(owner_id) + '_' + str(media_id)
How to represent this function like a lambda function? Do I need mark 'self' in the lambda variables?
Upvotes: 0
Views: 88
Reputation: 4935
No, you can just do this:
my_lambda = lambda type, owner_id, media_id: type + str(owner_id) + '_' + str(media_id)
Using a parameter called type
is a bad idea though since a function by that name already exists in Python and you overwrite it.
Upvotes: 2