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

Public Member Functions

def __init__ (self, target)
 
def __getitem__ (self, index)
 
def __len__ (self)
 
def __repr__ (self)
 

Detailed Description

Return a read-only view of the sequence object *target*.

:class:`SequenceView` objects are analogous to Python's built-in
"dictionary view" types. They provide a dynamic view of a sequence's items,
meaning that when the sequence updates, so does the view.

    >>> seq = ['0', '1', '2']
    >>> view = SequenceView(seq)
    >>> view
    SequenceView(['0', '1', '2'])
    >>> seq.append('3')
    >>> view
    SequenceView(['0', '1', '2', '3'])

Sequence views support indexing, slicing, and length queries. They act
like the underlying sequence, except they don't allow assignment:

    >>> view[1]
    '1'
    >>> view[1:-1]
    ['1', '2']
    >>> len(view)
    4

Sequence views are useful as an alternative to copying, as they don't
require (much) extra storage.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  target 
)

Member Function Documentation

◆ __getitem__()

def __getitem__ (   self,
  index 
)

◆ __len__()

def __len__ (   self)

◆ __repr__()

def __repr__ (   self)

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