cpython-3.3.0: Bindings for libpython

Safe HaskellNone

CPython.Types.List

Synopsis

Documentation

iterableToList :: Object iter => iter -> IO ListSource

Convert any object implementing the iterator protocol to a List.

getItem :: List -> Integer -> IO SomeObjectSource

Returns the object at a given position in the list. The position must be positive; indexing from the end of the list is not supported. If the position is out of bounds, throws an IndexError exception.

setItem :: Object o => List -> Integer -> o -> IO ()Source

Set the item at a given index.

insert :: Object item => List -> Integer -> item -> IO ()Source

Inserts item into the list in front of the given index. Throws an exception if unsuccessful. Analogous to list.insert(index, item).

append :: Object item => List -> item -> IO ()Source

Append item to the end of th list. Throws an exception if unsuccessful. Analogous to list.append(item).

getSlice :: List -> Integer -> Integer -> IO ListSource

Return a list of the objects in list containing the objects between the given indexes. Throws an exception if unsuccessful. Analogous to list[low:high]. Negative indices, as when slicing from Python, are not supported.

setSliceSource

Arguments

:: List 
-> Integer

Low

-> Integer

High

-> Maybe List

Replacement

-> IO () 

Sets the slice of a list between low and high to the contents of a replacement list. Analogous to list[low:high] = replacement. The replacement may be Nothing, indicating the assignment of an empty list (slice deletion). Negative indices, as when slicing from Python, are not supported.

sort :: List -> IO ()Source

Sort the items of a list in place. This is equivalent to list.sort().

reverse :: List -> IO ()Source

Reverses the items of a list in place. This is equivalent to list.reverse().

toTuple :: List -> IO TupleSource

Return a new Tuple containing the contents of a list; equivalent to tuple(list).