cpython-3.4.0: Bindings for libpython

Safe HaskellNone
LanguageHaskell98

CPython.Types.List

Contents

Synopsis

Documentation

iterableToList :: Object iter => iter -> IO List Source #

Convert any object implementing the iterator protocol to a List.

getItem :: List -> Integer -> IO SomeObject Source #

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 List Source #

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.

setSlice Source #

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 Tuple Source #

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

Orphan instances