Why return None?
Michael Hudson
mwh at python.net
Wed Aug 25 07:03:10 EDT 2004
Anthony Baxter <anthonybaxter at gmail.com> writes:
> 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...
It's a builtin now (as is reversed).
Cheers,
mwh
--
Back in the old days, software would grow until it could send and
receive e-mail, but now that even the virusses are doing that, the
fashion has changed, and now software evolves until it has venomous
fangs, the better to do serious damage when it sucks. -- AdB, asr
More information about the Python-list
mailing list