Why doesn't python's list append() method return the list itself?

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Jul 13 07:22:42 EDT 2010


John Nagle wrote:
> Arguably, if a function just does a "return",
> it should be an error to try to use its return value.

It's been suggested at least once before that the
default return value for a function should be some
special value that raises an exception if you try
to do anything with it except throw it away.

Unfortunately, the existence of such a value would
cause headaches for things like debuggers that need
to be able to deal with anything at all without
blowing up.

-- 
Greg



More information about the Python-list mailing list