Why return None?

Anthony Baxter anthonybaxter at gmail.com
Wed Aug 25 10:43:43 CEST 2004


On Wed, 25 Aug 2004 08:26:26 GMT, Martin DeMello
<martindemello at yahoo.com> wrote:
> It seems to be a fairly common pattern for an object-modifying method to
> return None - however, this is often quite inconvenient.

list.reverse() modifies the list in place. The python idiom is that
these don't return a reference to the modified list. Although note the
new list.sorted() method in 2.4...

Anthony



More information about the Python-list mailing list