OpenQuizz
Une application de gestion des contenus pédagogiques
PList Class Reference
Inheritance diagram for PList:
Collaboration diagram for PList:

Public Member Functions

def __new__ (cls, first, rest)
 
def __bool__ (self)
 
- Public Member Functions inherited from _PListBase
def __reduce__ (self)
 
def __len__ (self)
 
def __repr__ (self)
 
def cons (self, elem)
 
def mcons (self, iterable)
 
def reverse (self)
 
def split (self, index)
 
def __iter__ (self)
 
def __lt__ (self, other)
 
def __eq__ (self, other)
 
def __getitem__ (self, index)
 
def __hash__ (self)
 
def remove (self, elem)
 

Additional Inherited Members

- Static Public Attributes inherited from _PListBase
 count
 
 index
 

Detailed Description

Classical Lisp style singly linked list. Adding elements to the head using cons is O(1).
Element access is O(k) where k is the position of the element in the list. Taking the
length of the list is O(n).

Fully supports the Sequence and Hashable protocols including indexing and slicing but
if you need fast random access go for the PVector instead.

Do not instantiate directly, instead use the factory functions :py:func:`l` or :py:func:`plist` to
create an instance.

Some examples:

>>> x = plist([1, 2])
>>> y = x.cons(3)
>>> x
plist([1, 2])
>>> y
plist([3, 1, 2])
>>> y.first
3
>>> y.rest == x
True
>>> y[:2]
plist([3, 1])

Member Function Documentation

◆ __bool__()

def __bool__ (   self)

◆ __new__()

def __new__ (   cls,
  first,
  rest 
)

The documentation for this class was generated from the following file: