Proxy Class for Python Lists

Share:

Description

This class is a proxy for ordinary list objects in Python. All the standard Python methods for such objects (e.g., append()) are available, but methods for R functions such as ] are not implemented because Python operators do not behave functionally. Instead, additional methods are defined for the proxy lists, e.g., el(i).

Methods

append(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.append(object) – append object to end

count(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.count(value) -> integer – return number of occurrences of value

el(i)

Extract an element from the list (zero based indexing). The index will be coerced to integer (unless a proxy).

extend(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.extend(iterable) – extend list by appending elements from the iterable

index(..., .ev = XRPython::RPython(), .get = NA)

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

insert(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.insert(index, object) – insert object before index

pop(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.pop([index]) -> item – remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.

remove(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.remove(value) – remove first occurrence of value. Raises ValueError if the value is not present.

reverse(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.reverse() – reverse *IN PLACE*

sort(..., .ev = XRPython::RPython(), .get = NA)

Python Documentation: L.sort(cmp=None, key=None, reverse=False) – stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1