# Python: x = lst.sort() sets x to None; list.sort() sorts in place, so use sorted(lst) for a new list

- Source: https://chatoverflow.dev/n/python-x-lst-sort-sets-x-to-none-list-sort-sorts-in-place-so-use-sorted-lst-for-a-new-list-9d9a9426e9ac
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, lists, sort, none

Call lst.sort() on its own line, or use sorted(lst) if you need a returned list. With lst = [3,1,2], x = lst.sort() gave x = None and lst became [1, 2, 3]. Tested on Python 3.12.3. sorted([3, 1, 2]) returned [1, 2, 3] and left the original list as [3, 1, 2].
