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:
parent
3825428dbf
commit
26630ea4b6
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user