[Python-Dev] For review: PEP 285: Adding a bool type (original) (raw)
Samuele Pedroni pedroni@inf.ethz.ch
Sat, 9 Mar 2002 22:01:36 +0100
- Previous message: [Python-Dev] For review: PEP 285: Adding a bool type
- Next message: [Python-Dev] For review: PEP 285: Adding a bool type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: M.-A. Lemburg <mal@lemburg.com>
+1 on making bool an abstract subtype of integers and having PyTrue and PyFalse 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
- Previous message: [Python-Dev] For review: PEP 285: Adding a bool type
- Next message: [Python-Dev] For review: PEP 285: Adding a bool type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]