On 2005-07-22, Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, Ximo <[EMAIL PROTECTED]> wrote: >>Can I do a function which don't return anything? >> >>The question is that, if I do a function that have a return or without >>return, it returns always "None", but i want that it doesnt return me >>nothing > > What do you mean by "don't return anything", as oppossed to returning > None? Let's say I had one of those functions, and did: > > foo = noReturnValue() > print foo > > what would you expect (want?) to happen?
One supposes that if noReturnValue() really didn't return anything, then the above code would cause an exception. Personally, I don't really like the idea that falling off the botton of a function implicitly returns None. It's just not explicit enough for me. My preference would be that if the function didn't execute a "return" statement, then it didn't return anyting and attempting to use a return value would be an error. I suppose there probably is code out there that depends on the implicit "return None" at the end of every function, so it's too late to change things now. -- Grant Edwards grante Yow! Is it FUN to be at a MIDGET? visi.com -- http://mail.python.org/mailman/listinfo/python-list