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

Erik Max Francis max at alcyone.com
Tue Jan 8 15:31:07 EST 2002


"Elf M. Sternberg" wrote:

>         I'm using Webware for a project and noticed that in version
> 0.6
> Chuck finally included support for cascading style sheets.  I had put
> my
> own support into the project I was working on, and I notice that there
> seems to be a stylistic difference between what he did and what I did.
> For pages that don't need it (such as redirects), I defined it as:
> 
> def stylesheet(self):
>         return None
> 
> Whereas Webware used:
> 
> def writeStyleSheet(self):
>         pass
> 
>         Is there a reason for favoring one over the other?

Pure style issue.  I tend to use an explicit return None if the routine
really is a function and its value (None or not) will be used, or pass
if it's a producedure whose return value won't be checked.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Laws are silent in time of war.
\__/ Cicero
    Esperanto reference / http://www.alcyone.com/max/lang/esperanto/
 An Esperanto reference for English speakers.



More information about the Python-list mailing list