Package moul :: Package file :: Module wdysini :: Class BoolString
[hide private]
[frames] | no frames]

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


Instance Methods [hide private]
  __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__


Class Methods [hide private]
  _val2bool(cls, value)

Class Variables [hide private]
  __slots__ = ('_true',)
  _true = <member '_true' of 'BoolString' objects>

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__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

__int__(self)

 
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

Class Variable Details [hide private]

__slots__

None
Value:
('_true',)                                                             
      

_true

None
Value:
<member '_true' of 'BoolString' objects>