Skip to content

Commit

Permalink
Merge 5d80c8c into 4ccd27e
Browse files Browse the repository at this point in the history
  • Loading branch information
cdonovick authored Jun 7, 2019
2 parents 4ccd27e + 5d80c8c commit 4a5ecab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hwtypes/bit_vector_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ def size(cls) -> int:
def is_sized(cls) -> bool:
return cls.size is not None

def __len__(cls):
if cls.is_sized:
return cls.size
else:
raise AttributeError('unsized type has no len')


class AbstractBit(metaclass=ABCMeta):
@staticmethod
def get_family() -> TypeFamily:
Expand Down

0 comments on commit 4a5ecab

Please sign in to comment.