ch11-24: clean up by @eumiro & sync with Atlas

This commit is contained in:
Luciano Ramalho
2021-02-14 20:58:46 -03:00
parent 03ace4f4ae
commit 47cafc801a
143 changed files with 21692 additions and 63 deletions

View File

@@ -0,0 +1,29 @@
""" Example from `Python: The Full Monty`__ -- A Tested Semantics for the
Python Programming Language
__ http://cs.brown.edu/~sk/Publications/Papers/Published/pmmwplck-python-full-monty/
"The following program, [...] seems to perform a simple abstraction over the
process of yielding:"
Citation:
Joe Gibbs Politz, Alejandro Martinez, Matthew Milano, Sumner Warren,
Daniel Patterson, Junsong Li, Anand Chitipothu, and Shriram Krishnamurthi.
2013. Python: the full monty. SIGPLAN Not. 48, 10 (October 2013), 217-232.
DOI=10.1145/2544173.2509536 http://doi.acm.org/10.1145/2544173.2509536
"""
# tag::YIELD_DELEGATE_FAIL[]
def f():
def do_yield(n):
yield n
x = 0
while True:
x += 1
do_yield(x)
# end::YIELD_DELEGATE_FAIL[]
if __name__ == '__main__':
print('Invoking f() results in an infinite loop')
f()