🔵 🔵 🔵


Primary

၊၊||၊|။

list() ⚬ᵖʸ|Documentation|1st|20251021171804-00-⌔

Built-in Types — Python 3 documentation#list

class list(iterable=(),/)

Lists may be constructed in several ways:

  • Using a pair of square brackets to denote the empty list: []
  • Using square brackets, separating items with commas: [a], [a, b, c]
  • Using a list comprehension: [x for x in iterable]
  • Using the type constructor: list() or list(iterable)

The constructor builds a list whose items are the same and in the same order as iterable ’s items. iterable may be either a sequence, a container that supports iteration, or an iterator object. If iterable is already a list, a copy is made and returned, similar to iterable[:]. For example, list('abc') returns ['a', 'b', 'c'] and list((1, 2, 3)) returns [1, 2, 3]. If no argument is given, the constructor creates a new empty list, [].

Many other operations also produce lists, including the sorted() built-in.

Lists are generic over the types of their items.

Lists implement all of the common and mutable sequence operations. Lists also provide the following additional method:

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •