Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Commit 7ad69c9

Browse files
committed
Override __len__ in GenericType
Override __len__ in GenericType for `len(foo)` to return get_size()
1 parent 861f027 commit 7ad69c9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pyof/foundation/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ def __lshift__(self, shift):
121121
def __rshift__(self, shift):
122122
return self.value >> shift
123123

124+
def __len__(self):
125+
return self.get_size()
126+
124127
@property
125128
def value(self):
126129
"""Return this type's value.

0 commit comments

Comments
 (0)