python one line function definition

If you must have one line just make it a lambda:

perms = lambda xs: (list(x) for x in itertools.permutations(xs))

Quite often, when you have a short for loop for generating data you can replace it with either list comprehension or a generator expression for approximately the same legibility in slightly less space.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)