>> I don't see any incrementing going on... Fredrik> try this: Fredrik> class StupidCounter: Fredrik> count = 0 Fredrik> def __pos__(self): Fredrik> self.count = self.count + 1 Fredrik> return 0 # ignore extra __pos__ calls Fredrik> def __int__(self): Fredrik> return self.count Fredrik> def __repr__(self): Fredrik> return repr(self.count) Fredrik> c = StupidCounter() Fredrik> print c Fredrik> ++c Fredrik> print c Thanks, I understand now. Of course +c also increments the counter... S
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4