Class BoolString
object --+
|
BoolString
Boolean string
>>> BoolString(True)
true
>>> BoolString(1)
true
>>> bool(BoolString(1))
True
>>> int(BoolString(1))
1
>>> BoolString('yes'), BoolString('true'), BoolString('1')
(true, true, true)
>>> BoolString()
false
>>> BoolString(False)
false
>>> BoolString(0)
false
>>> bool(BoolString(0))
False
>>> int(BoolString(0))
0
>>> BoolString('no'), BoolString('false'), BoolString('0')
(false, false, false)
>>> BoolString('OK')
Traceback (most recent call last):
...
BoolStringError: 'OK' <type 'str'>
>>> BoolString(False) == False
True
>>> BoolString(True) == True
True
>>> BoolString(False) == True
False
>>> BoolString(True) == 'true'
True
>>> BoolString(True) == 'false'
False
>>> BoolString(False) == 'false'
True
|
__init__(self,
value=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
|
|
__nonzero__(self)
|
|
__int__(self)
|
|
__str__(self)
str(x)
|
|
__repr__(self)
repr(x)
|
|
__eq__(self,
other)
|
|
__cmp__(self,
other)
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|
|
__slots__ = ('_true',)
|
|
_true = <member '_true' of 'BoolString' objects>
|
Inherited from object :
__class__
|
__init__(self,
value=False)
(Constructor)
| |
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
-
- Overrides:
object.__init__
- (inherited documentation)
|
_val2bool(cls,
value)
Class Method
| |
None
-
- Decorators:
|
__nonzero__(self)
(Boolean test operator)
| |
None
-
|
__str__(self)
(Informal representation operator)
| |
str(x)
-
- Overrides:
object.__str__
- (inherited documentation)
|
__repr__(self)
(Representation operator)
| |
repr(x)
-
- Overrides:
object.__repr__
- (inherited documentation)
|
__eq__(self,
other)
(Equality operator)
| |
None
-
|
__cmp__(self,
other)
(Comparison operator)
| |
None
-
|
_true
None
-
- Value:
<member '_true' of 'BoolString' objects>
|
|