List Methods
list.clear()
Removes every element from the existing list. The list object keeps its identity, so aliases observe an empty list. Rebinding a name to [] instead leaves aliases pointing to the old list. Elements can remain alive through other references. Clearing an already empty list is valid.
Formal Syntax & Structure
python syntaxpython
items.clear()Return Value
None
The original list changes; no new list is returned.
Working Example
Example Snippetpython
queue = ["a", "b"]alias = queueresult = queue.clear()print(alias)print(queue is alias, result)