UserLinux chooses Python as "interpretive language" of choice

Jp Calderone exarkun at intarweb.us
Mon Dec 22 22:20:53 EST 2003


On Mon, Dec 22, 2003 at 08:07:27PM +0000, Jarek Zgoda wrote:
> Steve Lamb <grey at despair.dmiyu.org> pisze:
> 
> >>>   A function must return to have a return value.  When does sys.exit()
> >>> return?
> > 
> >> Something, that is of type NoneType.
> > 
> >     He didn't say what, he said when.  Can anyone show a program that will
> > evaluate the return of sys.exit() and successfully parse it?  =D
> 
> sys.exit() doesn't return to caller -- but it doesn't mean it doesn't
> return a value. Does this value is discarded? Didn't have time (and
> need) to check out.
> 

  I hope we can finally put this topic to rest.  sys.exit *does not have a
return value*:

static PyObject *
sys_exit(PyObject *self, PyObject *args)
{
        PyObject *exit_code = 0;
        if (!PyArg_ParseTuple(args, "|O:exit", &exit_code))
                return NULL;
        /* Raise SystemExit so callers may catch it or clean up. */
        PyErr_SetObject(PyExc_SystemExit, exit_code);
        return NULL;
}


  See?  "return NULL;" means "this function does not have a return value". 
If you still do not believe me, please go study the Python/C API until you
do.

  Jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20031222/5aa9a11a/attachment.sig>


More information about the Python-list mailing list