mirror of https://github.com/m-labs/artiq.git
language.core: make int compatible with range() (fixes #183).
This commit is contained in:
parent
3825428dbf
commit
26630ea4b6
|
@ -85,6 +85,10 @@ class int:
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self._value)
|
return str(self._value)
|
||||||
|
|
||||||
|
# range() etc call __index__, not __int__
|
||||||
|
def __index__(self):
|
||||||
|
return self._value
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "int({}, width={})".format(self._value, self._width)
|
return "int({}, width={})".format(self._value, self._width)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue