forked from M-Labs/artiq
1
0
Fork 0

language.core: make int compatible with range() (fixes #183).

This commit is contained in:
whitequark 2015-11-28 08:29:58 +08:00
parent 3825428dbf
commit 26630ea4b6
1 changed files with 4 additions and 0 deletions

View File

@ -85,6 +85,10 @@ class int:
def __str__(self):
return str(self._value)
# range() etc call __index__, not __int__
def __index__(self):
return self._value
def __repr__(self):
return "int({}, width={})".format(self._value, self._width)