schrodinger :: infra :: util :: OneIndexedList :: Class OneIndexedList
[hide private]
[frames] | no frames]

Class OneIndexedList

object --+    
         |    
      list --+
             |
            OneIndexedList

A list that starts at one instead of zero

Instance Methods [hide private]
 
__getitem__(self, index)
x[y]
 
__setitem__(self, index, value)
x[i]=y
 
__delitem__(self, index)
del x[y]
 
__getslice__(self, start, stop)
x[i:j]
 
__setslice__(self, start, stop, value)
x[i:j]=y
 
__delslice__(self, start, stop)
del x[i:j]
 
index(self, x)
L.index(value, [start, [stop]]) -> integer -- return first index of value.
 
insert(self, i, x)
insert object before index
item
pop(self, i)
remove and return item at index (default last).
int or slice
_convertIndex(self, index)
Convert a list index or slice from 0-indexed to 1-indexed
int
_convertScalarIndex(self, index)
Convert a list index from 0-indexed to 1-indexed
 
__add__(self, other)
x+y
 
__mul__(self, other)
x*n
 
__iadd__(self, other)
x+=y
 
__imul__(self, other)
x*=y

Inherited from list: __contains__, __eq__, __ge__, __getattribute__, __gt__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __reversed__, __rmul__, __sizeof__, append, count, extend, 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]

Inherited from object: __class__

Method Details [hide private]

__getitem__(self, index)
(Indexing operator)

 

x[y]

Overrides: list.__getitem__
(inherited documentation)

__setitem__(self, index, value)
(Index assignment operator)

 

x[i]=y

Overrides: list.__setitem__
(inherited documentation)

__delitem__(self, index)
(Index deletion operator)

 

del x[y]

Overrides: list.__delitem__
(inherited documentation)

__getslice__(self, start, stop)
(Slicling operator)

 

x[i:j]

Use of negative indices is not supported.

Overrides: list.__getslice__
(inherited documentation)

__setslice__(self, start, stop, value)
(Slice assignment operator)

 

x[i:j]=y

Use of negative indices is not supported.

Overrides: list.__setslice__
(inherited documentation)

__delslice__(self, start, stop)
(Slice deletion operator)

 

del x[i:j]

Use of negative indices is not supported.

Overrides: list.__delslice__
(inherited documentation)

index(self, x)

 

L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.

Overrides: list.index
(inherited documentation)

insert(self, i, x)

 

insert object before index

Overrides: list.insert
(inherited documentation)

pop(self, i)

 

remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.

Returns: item
Overrides: list.pop
(inherited documentation)

_convertIndex(self, index)

 

Convert a list index or slice from 0-indexed to 1-indexed

Parameters:
  • index (int or slice) - The index to convert
Returns: int or slice
The converted index
Raises:
  • ValueError - If the index is for element 0

_convertScalarIndex(self, index)

 

Convert a list index from 0-indexed to 1-indexed

Parameters:
  • index (int) - The index to convert
Returns: int
The converted index

__add__(self, other)
(Addition operator)

 

x+y

Overrides: list.__add__
(inherited documentation)

__mul__(self, other)

 

x*n

Overrides: list.__mul__
(inherited documentation)

__iadd__(self, other)

 

x+=y

Overrides: list.__iadd__
(inherited documentation)

__imul__(self, other)

 

x*=y

Overrides: list.__imul__
(inherited documentation)