How this is called and how to use it (rules/logic)


#1

I often see python codes like this : [[i for i, x in enumerate(searchList) if x == e] for e in elem] when they input if/for/etc in 1 line . How to do it , rules logic ? and what is difference to use {} or [] ?