Collection Classes

collections.UserList()

Wrap a list for customized sequence subclasses. The data attribute is a real list initialized from the supplied iterable.

Formal Syntax & Structure

python syntaxpython
collections.UserList(initialdata=None)

Parameters & Attributes

NameTypeDescription
initialdataiterable or NoneInitial elements.

Return Value

UserList

The UserList result described above.

Working Example

Example Snippetpython
import collectionsu=collections.UserList([1,2])u.append(3)print(u.data)
Python Reference