On Monday, December 31, 2012 5:23:42 PM UTC+1, Jean-Pierre Flori wrote: > > > > On Monday, December 31, 2012 4:51:16 PM UTC+1, Jean-Pierre Flori wrote: >> >> >> >> On Monday, December 31, 2012 4:29:18 PM UTC+1, Nils Bruin wrote: >>> >>> On Dec 31, 12:58 am, Jean-Pierre Flori <jpfl...@gmail.com> wrote: >>> > But then I had a look at the C code Cython generated and thought it >>> was >>> > the same... >>> > So we should look back at the C code, or ask a Python/Cython guru. >>> >>> The __delitem__ compiles as an ordinary method lookup and call, >>> whereas the "del A[..]" compiles as a straight call to PyDict_DelItem >>> (or whatever the name of the appropriate routine is). The preparation >>> of the parameter to either call seems to be the same. I agree it's >>> hard to argue that there's a fundamental difference between the two. >>> The "del ..." definitely seems preferable since it saves a method >>> lookup. >>> >> Yup and it's not yet clear to me how __delitem__ is resolved. >> In particular, in the dict objects definition, you have a nice >> correspondence set up for __getitem__ but nothing for __delitem__ (see >> mapp_methods in dictobjects.c), so this might in fact do complicated >> things. >> >>> >>> And it's not :) It's the right PyDict_DelItem which is.
> After a first (not so) quick look, I think it might be the generic > PyObject_DelItem which gets called in place of the PyDict_DelItem, not sure > though, I wasn't patient enough to run this under gdb to get confirmation. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To post to this group, send email to sage-devel@googlegroups.com. To unsubscribe from this group, send email to sage-devel+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en.