1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

add __int__ magic method to EnumType

This commit is contained in:
Keerthan Jaic 2015-07-21 17:51:36 -04:00
parent cb2332a37d
commit 1664847130

View File

@ -85,6 +85,9 @@ def enum(*names, **kwargs):
__str__ = __repr__
def __int__(self):
return int(self._val, 2)
def __hex__(self):
return hex(int(self._val, 2))