Interface MutableJythonSequence

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.python.core.PyObject __add__​(org.python.core.PyObject other)
      Override to allow adding another sequence to this one, using the bare + operator.
      org.python.core.PyObject __imul__​(org.python.core.PyObject other)
      Override to allow extending.
      void append​(org.python.core.PyObject element)
      Adds element to the end of the sequence.
      void extend​(org.python.core.PyObject sequence)
      Adds all elements from sequence to the end of the sequence.
      void insert​(int index, org.python.core.PyObject element)
      Adds element to sequence at position index.
      org.python.core.PyObject pop()
      Pops the last element off the sequence and returns it.
      org.python.core.PyObject pop​(int index)
      Pops the element at index off the sequence and returns it.
      void remove​(org.python.core.PyObject element)
      Removes element from the sequence, if it exists.
      void sort​(org.python.core.PyObject[] args, java.lang.String[] keywords)
      Sorts this list in place.
    • Method Detail

      • append

        void append​(org.python.core.PyObject element)
        Adds element to the end of the sequence.
      • extend

        void extend​(org.python.core.PyObject sequence)
        Adds all elements from sequence to the end of the sequence.
      • remove

        void remove​(org.python.core.PyObject element)
             throws org.python.core.PyException
        Removes element from the sequence, if it exists.
        Throws:
        org.python.core.PyException - Py.ValueError if the element is not in the sequence.
      • pop

        org.python.core.PyObject pop​(int index)
                              throws org.python.core.PyException
        Pops the element at index off the sequence and returns it. Should support negative values for index, to indicate offset from the end of the sequence.
        Throws:
        org.python.core.PyException - Py.IndexError if the index is not in range.
      • pop

        org.python.core.PyObject pop()
                              throws org.python.core.PyException
        Pops the last element off the sequence and returns it.
        Throws:
        org.python.core.PyException - Py.IndexError if the sequence is empty.
      • insert

        void insert​(int index,
                    org.python.core.PyObject element)
        Adds element to sequence at position index.
      • __add__

        org.python.core.PyObject __add__​(org.python.core.PyObject other)
        Override to allow adding another sequence to this one, using the bare + operator. Should return this sequence, with the additional elements from other added to the end.
        Returns:
        the result of the mul, or null if this operation is not defined
      • __imul__

        org.python.core.PyObject __imul__​(org.python.core.PyObject other)
        Override to allow extending. This is distinct from JythonSequence.__mul__(org.python.core.PyObject) in that __imul__ is called during a multiplicative assignment expression, ie x *= 3.
        Returns:
        the result of the mul, or null if this operation is not defined
      • sort

        void sort​(org.python.core.PyObject[] args,
                  java.lang.String[] keywords)
        Sorts this list in place. Can be passed with any combination (including none) of two arguments:
        • key: a key extraction function, which will be called per element of this sequence and should return whatever value should be use for comparison.
        • reverse: a boolean indicating that the results should be sorted in descending, rather than ascending, order.
        If no key function is provided, sort is 'natural' by element comparison.