Skip to content

Error in this documentation section: https://docs.python.org/3/tutorial/introduction.html#lists #131260

@diegoahenao

Description

@diegoahenao

Error in this documentation section https://docs.python.org/3/tutorial/introduction.html#lists, the following example shows a Deep Copy not a Shallow Copy, slice returns a Deep Copy:

All slice operations return a new list containing the requested elements. This means that the following slice returns a shallow copy of the list:

correct_rgba = rgba[:]
correct_rgba[-1] = "Alpha"
correct_rgba
["Red", "Green", "Blue", "Alpha"]
rgba
["Red", "Green", "Blue", "Alph"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions