1.1 --- a/lib/__builtins__/boolean.py Thu Nov 24 00:29:06 2016 +0100
1.2 +++ b/lib/__builtins__/boolean.py Thu Nov 24 00:58:36 2016 +0100
1.3 @@ -20,16 +20,30 @@
1.4 """
1.5
1.6 class boolean(object):
1.7 +
1.8 + "The type of the True and False objects."
1.9 +
1.10 def __bool__(self):
1.11 +
1.12 "Identity operation."
1.13 +
1.14 return self
1.15 +
1.16 def __str__(self):
1.17 +
1.18 + "Return a string representation."
1.19 +
1.20 return self is True and "True" or "False"
1.21
1.22 + __repr__ = __str__
1.23 +
1.24 False = boolean()
1.25 True = boolean()
1.26
1.27 def bool(obj):
1.28 +
1.29 + "Evaluate 'obj' as a boolean value."
1.30 +
1.31 return obj.__bool__()
1.32
1.33 # vim: tabstop=4 expandtab shiftwidth=4