Linked Questions

Popular Questions

One-line python for loop as function argument

Asked by At
def strange_syntax(stuff):
    return ".".join(item for item in stuff)

How (and why) works this code? What happens here? Normally I can't use this syntax. Also this syntax doesn't exist if it's not inside some function as argument.

I know, I could do the same with:

def normal_syntax(stuff):
    return ".".join(stuff)

Related Questions