Package pyxsd :: Module xsdDataTypes :: Class Boolean
[hide private]
[frames] | no frames]

Class Boolean

source code

 object --+        
          |        
        int --+    
              |    
 object --+   |    
          |   |    
XsdDataType --+    
              |    
        Integer --+
                  |
                 Boolean

Class for Boolean. The boolean type in python is not quite like other types in the language. The Boolean type class in python cannot be used as a base class or have its __init__ function used as it is with the other classes in the module. In python, the boolean type is really an integer that can either be 0 or 1. Since booleans are normally expressed as 'True' or 'False' in python, the programmer must be sure that True is entered as 1 and False as zero when using this class. The class has defined __str__ and __repr__ methods, so that the data is presented in a way that makes more sense in python or xml, depending on the use. __str__ is for python and __repr__ for python. Make sure to use the appropiate function when using booleans. Class has Integer as a base class.

Instance Methods [hide private]
  __init__(self, val)
  __str__(self)
Returns 'true' or 'false', depending on the value of 'val', when the str() function is used.
  __repr__(self)
Returns True or False, depending on the value of 'val', when the repr() function is used.

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__


Class Variables [hide private]
  name = 'Boolean'

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, val)
(Constructor)

source code 
None
Overrides: Integer.__init__

__str__(self)
(Informal representation operator)

source code 
Returns 'true' or 'false', depending on the value of 'val', when the str() function is used. Use for xml and xsd files.
Overrides: int.__str__

__repr__(self)
(Representation operator)

source code 
Returns True or False, depending on the value of 'val', when the repr() function is used. Use for python.
Overrides: int.__repr__

Class Variable Details [hide private]

name

None
Value:
'Boolean'