The old example did not illustrate the problem very well, as it works even without the unreachable branch.
x = 1
def a():
return x
print(a()) # Prints 1
This change fixes that by assigning to the global variable, which is not possible without the global keyword, thus better illustrating the execution of unreachable code.
The old example did not illustrate the problem very well, as it works even without the unreachable branch.
This change fixes that by assigning to the global variable, which is not possible without the
global
keyword, thus better illustrating the execution of unreachable code.