From: Simon Cross Date: Sat, 5 Mar 2016 22:30:06 +0000 (+0200) Subject: Poppable. X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=ea01c5200f06149c3ece055c576308601341144e;p=koperkapel.git Poppable. --- diff --git a/koperkapel/world.py b/koperkapel/world.py index 14746f5..a07b719 100644 --- a/koperkapel/world.py +++ b/koperkapel/world.py @@ -66,6 +66,11 @@ class World: obj, key = self._get_obj(name) obj.append(value) + def _apply_pop(self, action, updates): + for name, pos in updates.items(): + obj, key = self._get_obj(name) + obj.pop(pos) + def _apply_reset(self, action): self._state = self._build_initial_state() @@ -156,3 +161,6 @@ class WorldListProxy(WorldBaseProxy): def append(self, value): self._top._record_change(self._prefix, value, action="append") + + def pop(self, pos=0): + self._top._record_change(self._prefix, pos, action="pop")