__len__ and __bool__ for world list proxies.
authorSimon Cross <hodgestar@gmail.com>
Fri, 4 Mar 2016 22:41:50 +0000 (00:41 +0200)
committerSimon Cross <hodgestar@gmail.com>
Fri, 4 Mar 2016 22:41:50 +0000 (00:41 +0200)
koperkapel/world.py

index b0e3debfd16d830ee8d030aee2aa2eb4e5be8a3a..6a81f4c8a958fff21d419a1ee762c653e14828df 100644 (file)
@@ -128,3 +128,9 @@ class WorldListProxy(WorldBaseProxy):
 
     def __getitem__(self, index):
         return _maybe_subproxy(self, index, self._state[index])
+
+    def __len__(self):
+        return len(self._state)
+
+    def __bool__(self):
+        return bool(self._state)