Why return None?
danb_83 at yahoo.com
Wed Aug 25 20:58:53 CEST 2004
Dave Opstad <dave.opstad at agfamonotype.com> wrote in message news:<dave.opstad-E72D18.07305325082004 at reader0903.news.uu.net>...
> [discussion of why list.sort returns None instead of a list]
> But isn't the fact that the list is modified in place incidental to the
> fact of sorting? One is an implementation detail, and the other is the
> semantic meaning you're trying to express.
The fact that the list is sorted in-place *is* semantically
meaningful. It's often important to know whether the original list is
sorted or not.
More information about the Python-list