Package ndg :: Package xacml :: Package utils :: Class TypedList
[hide private]

Class TypedList

source code

object --+    
         |    
      list --+
             |
            TypedList

Extend list type to enabled only items of a given type. Supports any type where the array type in the Standard Library is restricted to only limited set of primitive types

Instance Methods [hide private]
new empty list
__init__(self, elementType, *arg, **kw)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
string
__repr__(self)
Returns: represent instance giving type information about the elements
source code
type
_getElementType(self)
Returns: the element type for this list
source code
 
extend(self, iter)
Extend a list with input iterable
source code
 
__iadd__(self, iter)
Extend a list with input iterable
source code
 
append(self, item)
Add an item to the list
source code

Inherited from list: __add__, __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __reversed__, __rmul__, __setitem__, __setslice__, __sizeof__, count, index, insert, pop, remove, reverse, sort

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from list: __hash__

Properties [hide private]
  elementType
The allowed type or types for list elements

Inherited from object: __class__

Method Details [hide private]

__init__(self, elementType, *arg, **kw)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • elementType (type/tuple) - object type or types which the list is allowed to contain. If more than one type, pass as a tuple
Returns: new empty list
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Returns: string
represent instance giving type information about the elements
Overrides: object.__repr__

_getElementType(self)

source code 
Returns: type
the element type for this list

extend(self, iter)

source code 

Extend a list with input iterable

Parameters:
  • iter (iterable type) - iterable object
Raises:
  • TypeError - input item doesn't match list type
Overrides: list.extend

__iadd__(self, iter)

source code 

Extend a list with input iterable

Parameters:
  • iter (iterable type) - iterable object
Raises:
  • TypeError - input item doesn't match list type
Overrides: list.__iadd__

append(self, item)

source code 

Add an item to the list

Parameters:
  • iter (iterable type) - iterable object
Raises:
  • TypeError - input item doesn't match list type
Overrides: list.append

Property Details [hide private]

elementType

The allowed type or types for list elements

Get Method:
_getElementType(self) - Returns: the element type for this list