Style question: 'return None' vs 'pass' in do-nothing methods?

brueckd at tbye.com brueckd at tbye.com
Tue Jan 8 14:38:00 EST 2002


On Tue, 8 Jan 2002, Elf M. Sternberg wrote:

> def stylesheet(self):
> 	return None
>
> Whereas Webware used:
>
> def writeStyleSheet(self):
> 	pass
>
> 	Is there a reason for favoring one over the other?

They are functionally equivalent, but I personally use the first when the
caller will be checking the return type (the return value of the function
actually has meaning) and the second when the return value has no meaning
(sort of like function vs. procedure in Pascal).

-Dave





More information about the Python-list mailing list