| | |
- list(object)
-
- WeakList
class WeakList(list) |
| |
list sub-class holding weakrefs to items
The weak reference list is intended to allow you
to store references to a list of objects without
needing to manage weak references directly.
For the most part, the WeakList operates just
like a list object, in that it allows for all
of the standard list operations. The difference
is that the WeakList class only stores weak
references to its items. As a result, adding
an object to the list does not necessarily mean
that it will still be there later on during
execution (if the referent has been garbage
collected). |
| |
- Method resolution order:
- WeakList
- list
- object
Methods defined here:
- __contains__(self, item)
- Return boolean indicating whether the item is in the list
- __eq__(self, sequence)
- Compare the list to another (==)
- __ge__(self, sequence)
- Compare the list to another (>=)
- __getitem__(self, index)
- Get the item at the given index
- __getslice__(self, start, stop)
- Get the items in the range start to stop
- __gt__(self, sequence)
- Compare the list to another (>)
- __iadd__ = extend(self, sequence)
- __init__(self, sequence=())
- Initialize the list, with an optional sequence of objects
The WeakList will store weak references to objects
within the sequence.
- __iter__(self)
- Iterate over the list, yielding strong references
- __le__(self, sequence)
- Compare the list to another (<=)
- __lt__(self, sequence)
- Compare the list to another (<)
- __ne__(self, sequence)
- Compare the list to another (!=)
- __repr__(self)
- Return a code-like representation of the weak list
- __setitem__(self, index, item)
- Set the item at the given index
- __setslice__(self, start, stop, sequence)
- Set a sequence of items from the start to the stop index
- append(self, item)
- Append a single item to the list
- count(self, item)
- Return integer count of instances of item in list
- extend(self, sequence)
- Extend this list with another sequence
- get(self)
- Get all items as a list of strong references
- index(self, item)
- Return integer index of item in list
- insert(self, index, item)
- Insert an item at the given index
- pop(self, index=-1)
- Pop an item from the list, removing it and returning it
- remove(self, item)
- Remove the given item from the list
- sort(self, function=None)
- Sort the list of objects
This sorts the objects referenced,
then rebuilds the list of references!
- unwrap(self, item)
- Unwrap an individual item
This is a fairly trivial operation at the moment,
it merely calls the item with no arguments and
returns the result.
- wrap(self, item)
- Wrap an individual item in a weak-reference
If the item is already a weak reference, we store
a reference to the original item. We use approximately
the same weak reference callback mechanism as the
standard weakref.WeakKeyDictionary object.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from list:
- __add__(...)
- x.__add__(y) <==> x+y
- __delitem__(...)
- x.__delitem__(y) <==> del x[y]
- __delslice__(...)
- x.__delslice__(i, j) <==> del x[i:j]
Use of negative indices is not supported.
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __imul__(...)
- x.__imul__(y) <==> x*=y
- __len__(...)
- x.__len__() <==> len(x)
- __mul__(...)
- x.__mul__(n) <==> x*n
- __reversed__(...)
- L.__reversed__() -- return a reverse iterator over the list
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- L.__sizeof__() -- size of L in memory, in bytes
- reverse(...)
- L.reverse() -- reverse *IN PLACE*
Data and other attributes inherited from list:
- __hash__ = None
- __new__ = <built-in method __new__ of type object at 0x8187c0>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
| |