Commit 208ba244 authored by Robert Bradshaw's avatar Robert Bradshaw

Test for inplace fix.

parent eace932b
...@@ -244,3 +244,13 @@ def double_deref_and_increment(o, key1, key2): ...@@ -244,3 +244,13 @@ def double_deref_and_increment(o, key1, key2):
v __setitem__ a 11 v __setitem__ a 11
""" """
o[side_effect(key1)][side_effect(key2)] += 1 o[side_effect(key1)][side_effect(key2)] += 1
def conditional_inplace(value, a, condition, b):
"""
>>> conditional_inplace([1, 2, 3], [100], True, [200])
[1, 2, 3, 100]
>>> conditional_inplace([1, 2, 3], [100], False, [200])
[1, 2, 3, 200]
"""
value += a if condition else b
return value
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment