for in 'abc'for in 'lmn'res append( yres ['al''am''an''bl''bm''bn''cl''cm''cn'beyond this complexity levelthoughlist comprehension expressions can often become too compact for their own good in generalthey are intended for simple types of iterationsfor more involved worka simpler for statement structure will probably be easier to understand and modify in the future as usual in programmingif something is difficult for you to understandit' probably not good idea because comprehensions are generally best taken in multiple doseswe'll cut this story short here for now we'll revisit list comprehensions in in the context of functional programming toolsand will define their syntax more formally and explore additional examples there as we'll findcomprehensions turn out to be just as related to functions as they are to looping statements blanket qualification for all performance claims in this booklist comprehension or otherthe relative speed of code depends much on the exact code tested and python usedand is prone to change from release to release for examplein cpython and todaylist comprehensions can still be twice as fast as corresponding for loops on some testsbut just marginally quicker on othersand perhaps even slightly slower on some when if filter clauses are used we'll see how to time code in and will learn how to interpret the file listcomp-speed txt in the book examples packagewhich times this code for nowkeep in mind that absolutes in performance benchmarks are as elusive as consensus in open source projectsother iteration contexts later in the bookwe'll see that user-defined classes can implement the iteration protocol too because of thisit' sometimes important to know which built-in tools make use of it--any tool that employs the iteration protocol will automatically work on any built-in type or user-defined class that provides it so fari've been demonstrating iterators in the context of the for loop statementbecause this part of the book is focused on statements keep in mindthoughthat every built-in tool that scans from left to right across objects uses the iteration protocol this includes the for loops we've seenfor line in open('script py')print(line upper()end=''use file iterators other iteration contexts