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:
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: