2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 19:28:26 +08:00

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

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)