moshe wrote: > Everybody is ignoring the obvious correct way to do it: > > class StupidCounter: > count = 0 > def __pos__(self): > self.count = self.count+0.5 > return self > def __repr__(self): return str(int(self.count)) > def __int__(self): return int(self.count) that was my first implementation (TooStupidCounter). but to avoid an endless float vs. integer thread, I decided to post the plain StupidCounter version instead. (SlightlyLessStupidCounter is same as StupidCounter, but returns self.count instead of 0) </F>
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