[Tutor] If a method has no return type?

wesley chun wescpy at gmail.com
Thu Feb 7 07:32:22 CET 2013


On Thu, Feb 7, 2013 at 12:09 AM, Sunil Tech <sunil.techspk at gmail.com> wrote:

> If a method has no return type?
> what will it return?
>

note the original question is partially invalid... Python functions and
methods aren't typed. however, i imagine the OP really meant *return value*
instead, so the answer is really the following:
functions *and* methods with no explicit return *value* return None... this
happens when you either have no return statement or just return by itself
with no object given.

one exception is __init__()... you're never supposed to return anything
from it... ever. i can't think of any others... can you?

best regards,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A computer never does what you want... only what you tell it."
    +wesley chun : wescpy at gmail : @wescpy
    Python training & consulting : http://CyberwebConsulting.com
    "Core Python" books : http://CorePython.com
    Python blog: http://wescpy.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130207/8a66a6b3/attachment-0001.html>


More information about the Tutor mailing list