Package commons :: Module structs :: Class ListMixin
[hide private]
[frames] | no frames]

Class ListMixin

source code

object --+
         |
        ListMixin
Known Subclasses:

Defines all list operations from a small subset of methods.

Subclasses should define _get_element(i), _set_element(i, value), __len__(), _resize_region(start, end, new_size) and _constructor(iterable). Define __iter__() for extra speed.

The _get_element() and _set_element() methods are given indices with 0 <= i < len(self).

The _resize_region() method should resize the slice self[start:end] so that it has size new_size. It is given indices such that start <= end, 0 <= start <= len(self) and 0 <= end <= len(self). The resulting elements in self[start:start+new_size] can be set to None or arbitrary Python values.

The _constructor() method accepts an iterable and should return a new instance of the same class as self, populated with the elements of the given iterable.

From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440656.


Copyright: Connelly Barns

Instance Methods [hide private]
 
__cmp__(self, other) source code
 
__hash__(self)
hash(x)
source code
 
__iter__(self) source code
 
_tuple_from_slice(self, i)
Get (start, end, step) tuple from slice object.
source code
 
_fix_index(self, i) source code
 
__getitem__(self, i) source code
 
__setitem__(self, i, value) source code
 
__delitem__(self, i) source code
 
__add__(self, other) source code
 
__mul__(self, other) source code
 
__radd__(self, other) source code
 
__rmul__(self, other) source code
 
__iadd__(self, other) source code
 
__imul__(self, other) source code
 
append(self, other) source code
 
extend(self, other) source code
 
count(self, other) source code
 
reverse(self) source code
 
index(self, x, i=0, j=None) source code
 
insert(self, i, x) source code
 
pop(self, i=None) source code
 
remove(self, x) source code
 
sort(self, cmpfunc=None, key=None, reverse=False) source code
 
__copy__(self) source code
 
__deepcopy__(self, memo={}) source code
 
__str__(self, track=[])
str(x)
source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __init__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)

__str__(self, track=[])
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)