Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added __len__ method for mobjects

Grant Sanderson2d4ce0bd887f
diff --git a/mobject/mobject.py b/mobject/mobject.py
index e6cd04d51..96bc986ff 100644
--- a/mobject/mobject.py
+++ b/mobject/mobject.py
@@ -526,6 +526,9 @@ class Mobject(object):
def __iter__(self):
return iter(self.split())
+ def __len__(self):
+ return len(self.split())
+
def split(self):
result = [self] if len(self.points) > 0 else []
return result + self.submobjects