# HG changeset patch # User Paul Boddie # Date 1558363745 -7200 # Node ID a616c0c860582ade2bf0a085deeb935149ceefa4 # Parent c7eaa76e5b0febf97268d704f89348669c4e3b55 Demonstrate undesirable side-effects caused by escaping temporary objects. diff -r c7eaa76e5b0f -r a616c0c86058 tests/temp_side_effects.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/temp_side_effects.py Mon May 20 16:49:05 2019 +0200 @@ -0,0 +1,12 @@ +def f(x): + x + 10 + return x + +a = 1.0 +b = 2.0 +c = 3.0 +d = f(a * b) + +print a * b + c # 5.0 +print d + c # 5.0 +print d # 2.0