Skip to content

Commit

Permalink
add more magic methods so we can use AtomicInteger as an int more eas…
Browse files Browse the repository at this point in the history
…ily: adds compare, equality and "int"

git-svn-id: https://xpra.org/svn/Xpra/trunk@5417 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 10, 2014
1 parent 4029073 commit e689146
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/xpra/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ def get(self):
def __str__(self):
return str(self.counter)

def __int__(self):
return self.counter

def __eq__(self, other):
try:
return self.counter==int(other)
except:
return -1

def __cmp__(self, other):
try:
return self.counter-int(other)
except:
return -1


class typedict(dict):

Expand Down

0 comments on commit e689146

Please sign in to comment.