Commit 54797f8b authored by Brenden Blanco's avatar Brenden Blanco

Add a table.zero() function to bcc.TableBase

It is sometimes useful to zero out the entries of table without erasing
the keys. Add a zero() function to make this easy.
Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent d1a0e7f2
...@@ -186,6 +186,10 @@ class TableBase(MutableMapping): ...@@ -186,6 +186,10 @@ class TableBase(MutableMapping):
for k in self.keys(): for k in self.keys():
self.__delitem__(k) self.__delitem__(k)
def zero(self):
for k in self.keys():
self[k] = self.Leaf()
def __iter__(self): def __iter__(self):
return TableBase.Iter(self, self.Key) return TableBase.Iter(self, self.Key)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment