Generated by Cython 0.12.1 on Fri May 7 14:04:47 2010
Raw output: _Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.c
1:
2: include "interrupt.pxi" # ctrl-c interrupt block support
3: include "stdsage.pxi" # ctrl-c interrupt block support
4:
5: include "cdefs.pxi"
6: cdef class TwoNumbers:
7: cdef int a,b
8: def __init__(self, a, b):
static int __pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___init__[] = "File: _Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.pyx (starting at line 8)"; static int __pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_a = 0; PyObject *__pyx_v_b = 0; int __pyx_r; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,0}; __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_a = values[0]; __pyx_v_b = values[1]; } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { __pyx_v_a = PyTuple_GET_ITEM(__pyx_args, 0); __pyx_v_b = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.TwoNumbers.__init__"); return -1; __pyx_L4_argument_unpacking_done:;
9: self.a = a
__pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_a); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_TwoNumbers *)__pyx_v_self)->a = __pyx_t_1;
10: self.b = b
__pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_b); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_TwoNumbers *)__pyx_v_self)->b = __pyx_t_1; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.TwoNumbers.__init__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
11: def sum(self):
static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers_sum(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static char __pyx_doc_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers_sum[] = "File: _Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.pyx (starting at line 11)";
static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers_sum(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannySetupContext("sum");
12: return self.a + self.b
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_TwoNumbers *)__pyx_v_self)->a + ((struct __pyx_obj_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_TwoNumbers *)__pyx_v_self)->b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.TwoNumbers.sum"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
13: def sum_a_lot(self, N):
static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers_sum_a_lot(PyObject *__pyx_v_self, PyObject *__pyx_v_N); /*proto*/ static char __pyx_doc_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers_sum_a_lot[] = "File: _Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.pyx (starting at line 13)"; static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers_sum_a_lot(PyObject *__pyx_v_self, PyObject *__pyx_v_N) { PyObject *__pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("sum_a_lot"); __Pyx_INCREF((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_v_N); __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
14: for i in range(N):
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_N); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_N); __Pyx_GIVEREF(__pyx_v_N); __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); } else { __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; } else { __pyx_t_3 = PyIter_Next(__pyx_t_2); if (!__pyx_t_3) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_DECREF(__pyx_v_i); __pyx_v_i = __pyx_t_3; __pyx_t_3 = 0;
15: self.sum()
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__sum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.TwoNumbers.sum_a_lot"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_i); __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_DECREF(__pyx_v_N); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
16: def __repr__(self):
static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___repr__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___repr__[] = "File: _Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.pyx (starting at line 16)";
static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___repr__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannySetupContext("__repr__");
17: return "The numbers %s and %s" % (self.a, self.b)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_TwoNumbers *)__pyx_v_self)->a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_TwoNumbers *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.TwoNumbers.__repr__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
18: def __str__(self):
static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___str__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___str__[] = "File: _Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.pyx (starting at line 18)";
static PyObject *__pyx_pf_75_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0_10TwoNumbers___str__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannySetupContext("__str__");
19: return repr(self)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyObject_Repr(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("_Users_robertwb__sage_sage_notebook_sagenb_home_admin_91_code_sage58_spyx_0.TwoNumbers.__str__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }