- 论坛徽章:
- 0
|
觉得lambda的用法有点神,所以贴出来,有待进一步研究!
/*Python-ast.c*/
expr_ty
Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena
*arena)
{
expr_ty p;
if (!args) {
PyErr_SetString(PyExc_ValueError,
"field args is required for Lambda");
return NULL;
}
if (!body) {
PyErr_SetString(PyExc_ValueError,
"field body is required for Lambda");
return NULL;
}
p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
if (!p) {
PyErr_NoMemory();
return NULL;
}
p->kind = Lambda_kind;
p->v.Lambda.args = args;
p->v.Lambda.body = body;
p->lineno = lineno;
p->col_offset = col_offset;
return p;
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17118/showart_97193.html |
|