advanced programming techniques in either case the function is expected to be called with list of filenamesfor examplesys argv[ :]as its argument on windows the function iterates over all the names listed for each filenamethe function yields the namebut for nonfiles (usually directories)the glob module' glob iglob(function is used to return an iterator to the names of the files that the name represents after wildcard expansion for an ordinary name like autoexec bat an iterator that produces one item (the nameis returnedand for name that uses wildcards like txt an iterator that produces all the matching files (in this case those with extension txtis returned (there is also glob glob(function that returns list rather than an iterator on unix the shell does wildcard expansion for usso we just need to return generator for all the files whose names we have been given generator functions can also be used as coroutinesif we structure them correctly coroutines are functions that can be suspended in mid-execution (at the yield expression)waiting for the yield to provide result to work onand once received they continue processing as we will see in the coroutines subsection later in this )coroutines can be used to distribute work and to create processing pipelines dynamic code execution and dynamic imports |there are some occasions when it is easier to write piece of code that generates the code we need than to write the needed code directly and in some contexts it is useful to let users enter code ( functions in spreadsheet)and to let python execute the entered code for us rather than to write parser and handle it ourselves--although executing arbitrary code like this is potential security riskof course another use case for dynamic code execution is to provide plug-ins to extend program' functionality using plug-ins has the disadvantage that all the necessary functionality is not built into the program (which can make the program more difficult to deploy and runs the risk of plug-ins getting lost)but has the advantages that plug-ins can be upgraded individually and can be provided separatelyperhaps to provide enhancements that were not originally envisaged dynamic code execution the easiest way to execute an expression is to use the built-in eval(function we first saw in for examplex eval("( * " = the glob glob(functions are not as powerful assaythe unix bash shellsince although they support the *?and [syntaxesthey don' support the {syntax