Skip to content

Commit

Permalink
language.core: make int compatible with range() (fixes #183).
Browse files Browse the repository at this point in the history
whitequark committed Nov 28, 2015
1 parent 3825428 commit 26630ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions artiq/language/core.py
Original file line number Diff line number Diff line change
@@ -85,6 +85,10 @@ def __float__(self):
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)

0 comments on commit 26630ea

Please sign in to comment.