6.2.4.2.8. get

Comienzo python section to interscript/core/mxTools.py[9 /26 ] Siguiente Previo Primero Último
    48: #line 849 "mxTools.pak"
    49: def get(object,index, default = NotGiven):
    50:   try:
    51:     return object[index]
    52:   except KeyboardInterrupt: raise
    53:   except:
    54:     if default is not NotGiven:
    55:       return default
    56:     else: raise
    57: 
End python section to interscript/core/mxTools.py[9]
Comienzo C section to interscript/core/mxTools.c[10 /30 ] Siguiente Previo Primero Último
   718: #line 859 "mxTools.pak"
   719: 
   720: Py_C_Function( mxTools_get,
   721:                "get(object,index[,default])\n\n"
   722:                "Returns object[index], or, if that fails, default.")
   723: {
   724:     PyObject *x, *w, *index;
   725:     PyObject *def = mxNotGiven;
   726: 
   727:     Py_Get3Args("OO|O",w,index,def);
   728: 
   729:     x = PyObject_GetItem(w,index);
   730:     if (!x) {
   731:         if (def != mxNotGiven) {
   732:             PyErr_Clear();
   733:             x = def;
   734:             Py_INCREF(x);
   735:         }
   736:         else
   737:             goto onError;
   738:     }
   739:     return x;
   740: 
   741:  onError:
   742:     return NULL;
   743: }
   744: 
End C section to interscript/core/mxTools.c[10]