From: M.-A. Lemburg <mal@lemburg.com> > > +1 on making bool an abstract subtype of integers > and having Py_True and Py_False as only instances > > -1 on overriding interfaces other than informational > ones such as __repr__ > So you mean just: class truth(int): # other names?, should not be subclassable def __new__(cls,val): # ?? if val: return true else: return false def __repr__(self): if self: return 'true' else: return 'false' true = int.__new__(truth,1) # also Py_True false = int.__new__(truth,0) # also Py_False
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