once insteadgenerator expressions return generator objectwhich yields one item in the result at time when used in an iteration context generators are iterable objects that support the iteration protocol automatically-they have an iterator with __next__ method (next in xthat repeatedly advances to the next item in series of results and raises an exception at the end of the series in pythonwe can code generator functions with def and yieldgenerator expressions with parenthesized comprehensionsand generator objects with classes that define special method named __iter__ (discussed later in the book generator function has yield statement somewhere in its code generator functions are otherwise identical to normal functions syntacticallybut they are compiled specially by python so as to return an iterable generator object when called that object retains state and code location between values when presentthis statement makes python compile the function specially as generatorwhen calledthe function returns generator object that supports the iteration protocol when the yield statement is runit sends result back to the caller and suspends the function' statethe function can then be resumed after the last yield statementin response to next built-in or __next__ method call issued by the caller in more advanced rolesthe generator send method similarly resumes the generatorbut can also pass value that shows up as the yield expression' value generator functions may also have return statementwhich terminates the generator the map call is similar to list comprehension--both produce series of valuesby collecting the results of applying an operation to each item in sequence or other iterableone item at time the primary difference is that map applies function call to each itemand list comprehensions apply arbitrary expressions because of thislist comprehensions are more generalthey can apply function call expression like mapbut map requires function to apply other kinds of expressions list comprehensions also support extended syntax such as nested for loops and if clauses that subsume the filter built-in in python xmap also differs in that it produces generator of valuesthe list comprehension materializes the result list in memory all at once in xboth tools create result lists test your knowledgeanswers