List mutation method gotcha - How well known?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Mar 15 02:01:52 EDT 2008


On Fri, 14 Mar 2008 11:32:41 -0700, Lie wrote:

> No, there is no need for "void" return type, what I meant is that
> everything that's not said in the documentation should be assumed to
> be an implementation detail, a method or a function that doesn't say
> anything about its return type should be assumed to return an
> implementation detail (which basically means: Don't rely on this). The
> fact that list.append returns none is just a coincidence, you might
> encounter another list.append that returns different thing some time
> in the future, or the far future, or perhaps at the end of the
> galaxy's life.

I expect functions with no documentation of what they return to return
`None`.  Assuming they are documented at all, of course.  :-)

It's like not writing a ``return`` statement in the code: there's always an
implicit ``return None`` at the end of every function.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list