Sequential container node.
Methods
|
|
|
|
__add__
|
__add__ ( self, other )
invoked by self+other
- other
- must be a list type, an instance of UserList or another
instance of List.
|
|
__bindto__
|
__bindto__ (
self,
database,
path=(),
parent=None,
)
Bind the list to a new storage location.
Overloaded to load the lookup table from disk.
|
|
__clear__
|
__clear__ ( self )
Empty the List.
Overloaded to delete the list items.
|
|
__cmp__
|
__cmp__ ( self, other )
Comparison operator.
Overloaded to more adaquately compare Dict to other values.
|
|
__copyfrom__
|
__copyfrom__ ( self, other )
Copy data from other.
Overloaded to copy over other's list items as well as its lookup.
|
|
__delitem__
|
__delitem__ ( self, index )
Delete an item from the list located at a specific position.
- index
- position in the list at which to delete the item.
If index goes beyond the bounds of the list, this raises an IndexError.
|
|
__delslice__
|
__delslice__ (
self,
index,
until,
)
Delete a slice from the list.
- index
- position at which to start deleting
- until
- position at which to stop deleting
|
|
__eq__
|
__eq__ ( self, other )
Test for equality.
|
|
__ge__
|
__ge__ ( self, other )
Test for greater of equal to.
|
|
__getitem__
|
__getitem__ ( self, index )
Retrive item at index.
|
|
__getslice__
|
__getslice__ (
self,
index,
until,
)
Retrieve a slice of the list.
- index
- beginning of the slice
- until
- end of the slice (non-inclusive)
|
|
__gt__
|
__gt__ ( self, other )
Test for greater than.
|
|
__iadd__
|
__iadd__ ( self, other )
Invoked by self+=other
- other
- must be a list type, an instance of UserList or another
instance of List.
|
|
__imul__
|
__imul__ ( self, other )
Invoked by self*=other
- other
- must be an integer
|
|
__init__
|
__init__ (
self,
initval=None,
**keywords,
)
Constructor.
Arguments:
- initval
- optional initial value. Can be a regular python list,
an instance of UserList or another instance of List.
Optional keyword arguments (in addition to those for Node):
- oftype
- initial value for __oftype__.
|
|
__le__
|
__le__ ( self, other )
Test for lesser or equal to.
|
|
__lt__
|
__lt__ ( self, other )
Test for lesser than.
|
|
__moveto__
|
__moveto__ (
self,
database,
path=(),
parent=None,
)
Move the list to a new storage location.
Overloaded to copy list items to the new location.
|
|
__mul__
|
__mul__ ( self, other )
Invoked by self*other
- other
- must be an integer
|
|
__ne__
|
__ne__ ( self, other )
Test for inequality.
|
|
__radd__
|
__radd__ ( self, other )
Invoked by other+self.
- other
- must be a list type, an instance of UserList or another
instance of List.
|
|
__repr__
|
__repr__ ( self )
String representation.
Overloaded to better represent a List instance.
|
|
__setitem__
|
__setitem__ (
self,
index,
value,
)
Assign a list item to a specific position in the list.
- index
- position in the list at which to assign the item.
If self.__oftype__ is not None and `value` is not of that type, raises
a TypeError.
|
|
__setslice__
|
__setslice__ (
self,
index,
until,
replacement,
)
Replace slice with another list.
- index
- beginning of the slice
- until
- end of the slice (non-inclusive)
- replacement
- replacement list.
If self.__oftype__ is not None and the items in `replacement` are not
of that type, raises a TypeError.
|
|
__setval__
|
__setval__ ( self, value )
Data assignment for list attributes.
Accepts instances of list.
Exceptions
|
|
TypeError( "value must be an instance of list" )
|
|
|
append
|
append ( self, value )
Inserts an item at the end of the list.
- value
- item to insert.
If self.__oftype__ is not None and `value` is not of that type, raises
a TypeError.
|
|
count
|
count ( self, value )
Returns the number of times `value` appears in the list.
- value
- value to count
|
|
extend
|
extend ( self, extension )
Extend this list with another list.
- extension
- extension to append to the list.
|
|
index
|
index ( self, value )
Return the index of the first occurence of `value`.
- value
- value for which to search.
If the item is not found, raises an IndexError.
|
|
insert
|
insert (
self,
index,
value,
)
Insert an item at a specific position in the list.
- index
- position in the list at which to insert the new item.
- value
- item to insert.
If self.__oftype__ is not None and `value` is not of that type, raises
a TypeError.
|
|
pop
|
pop ( self, index=-1 )
Remove and return the list item located at position `index`.
- index
- position of the item you wish to fetch and remove.
|
|
remove
|
remove ( self, value )
Locate and remove item from the list.
- value
- item to locate and remove.
If the item is not found, raises IndexError.
|
|
reverse
|
reverse ( self )
Reverse the order of the list.
The first item becomes the last, the second becomes the before last,
the last becomes the first, etc.
|
|
sort
|
sort ( self, *args )
Sort the list by value of its items
|