skip wrote: > How? ++x compiles to > > LOAD_FAST x > UNARY_POSITIVE > UNARY_POSITIVE > > I don't see any incrementing going on... try this: class StupidCounter: count = 0 def __pos__(self): self.count = self.count + 1 return 0 # ignore extra __pos__ calls def __int__(self): return self.count def __repr__(self): return repr(self.count) c = StupidCounter() print c ++c print c </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