micropython

tests/failure/outer_stupid_explicit.py

803:39ba98ecc020
2014-06-01 Paul Boddie Fixed a docstring to describe the method's actual return value. syspython-as-target
     1 #!/usr/bin/env python     2      3 "Inspired by difflib._mdiff._line_iterator and its from_line variable."     4      5 def outer():     6     def inner(x):     7         if x:     8             y = 1       9             return y    10         else:    11             return y    12     y = 2    13     return inner    14     15 result_1 = outer()(1)    16 result_2 = outer()(0) # CPython fails with UnboundLocalError in inner    17     18 # vim: tabstop=4 expandtab shiftwidth=4