Sahaj.blogs

Day page

24 Aug 2023

Study

Python · Lists

Lists as mutable sequences: append vs extend, slicing, sorting in place vs sorted(), and the aliasing trap.

  • b = a does not copy a list; both names point to the same object.
  • list.sort() changes the list and returns None; sorted() returns a new list.

Read the post →