"Cecilia Alm" <[EMAIL PROTECTED]> wrote

> functions which lack a return statement ('procedures') actually 
> return "None".
> For such functions, I assume it's preferred to not catch "None" in a 
> variable.

You can catch it if you like, but since functions with no return
*always* return None there is little point. You know what the
value will be before you even call the function.

Where catching the value is more important is where the function
only has some return statements:

def f(x):
   if x: return 42

Now f() returns None if x is not True so it makers sense to
catch the reurn value and test for None.

But such a function style is very bad practice IMHO!

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to