import itertools as its class Solution(object): def letterCombinations(self, digits): g = map( lambda x: [' ','*','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz'][int(x)], digits ) return [''.join(i) for i in its.product(*g)] if digits else 
It's 3-line if the import line is counted. :)
itertools for us, so if you use it by that name, you don't need to import it here.
If you write
return map(''.join, itertools.product(*g)) if digits else 
then the line doesn't even get longer but shorter.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.