Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 35b787c

Browse files
Shorthand for True False
1 parent bbe9f3d commit 35b787c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,14 @@ def __delitem__(self, key):
606606
for i, (value, item) in enumerate(self.A):
607607
if item == key:
608608
self.A.pop(i)
609+
610+
# ______________________________________________________________________________
611+
# Useful Shorthands
612+
613+
614+
class Bool(int):
615+
"""Just like `bool`, except values display as 'T' and 'F' instead of 'True' and 'False'"""
616+
__str__ = __repr__ = lambda self: 'T' if self else 'F'
617+
618+
T = Bool(True)
619+
F = Bool(False)

0 commit comments

Comments
 (0)