Poppable.
authorSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 22:30:06 +0000 (00:30 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 22:30:06 +0000 (00:30 +0200)
koperkapel/world.py

index 14746f530760e6a092345b7f78abf834430a7598..a07b719a41a79e5882d8fcb7b2da03dfdb8bb7b9 100644 (file)
@@ -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")