diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/compiler/misc.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/compiler/misc.py b/Lib/compiler/misc.py index 0dc6422..a281c10 100644 --- a/Lib/compiler/misc.py +++ b/Lib/compiler/misc.py @@ -1,6 +1,8 @@ class Set: def __init__(self): self.elts = {} + def __len__(self): + return len(self.elts) def add(self, elt): self.elts[elt] = elt def items(self): @@ -14,6 +16,8 @@ class Stack: def __init__(self): self.stack = [] self.pop = self.stack.pop + def __len__(self): + return len(self.stack) def push(self, elt): self.stack.append(elt) def top(self): |