mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 04:09:05 +00:00
fix: #408
This commit is contained in:
parent
f7fb06e10a
commit
c5848db951
5 changed files with 47 additions and 5 deletions
|
@ -37,6 +37,10 @@ class Int(int):
|
|||
return then__(int.__pow__(self, other), Int)
|
||||
def __rpow__(self, other):
|
||||
return then__(int.__pow__(other, self), Int)
|
||||
def __pos__(self):
|
||||
return self
|
||||
def __neg__(self):
|
||||
return then__(int.__neg__(self), Int)
|
||||
|
||||
class IntMut(): # inherits Int
|
||||
value: Int
|
||||
|
@ -102,6 +106,10 @@ class IntMut(): # inherits Int
|
|||
return IntMut(self.value ** other)
|
||||
else:
|
||||
return IntMut(self.value ** other.value)
|
||||
def __pos__(self):
|
||||
return self
|
||||
def __neg__(self):
|
||||
return IntMut(-self.value)
|
||||
def inc(self, i=1):
|
||||
self.value = Int(self.value + i)
|
||||
def dec(self, i=1):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue