Re: [Zope-dev] ExtensionClass and __radd__()?

2000-07-06 Thread Greg Ward

On 06 July 2000, Pavlos Christoforou said:
> A quick note which you probably already know:
> 
> grep add ExtensionClass.c gives:
[...lots...]
> whereas grep radd ExtensionClass.c returns nothing

Yep, did the same myself shortly after posting.  It's not really clear
what 'py__add__' is and how it works, though, so it's not obvious if
'py__radd__' is the right thing to add, and if so how to add it.

Greg


If it's just a matter
of adding radd (and rsub, rmul, and rdiv) in all those places
-- 
Greg Ward - software developer[EMAIL PROTECTED]
MEMS Exchange / CNRI   voice: +1-703-262-5376
Reston, Virginia, USAfax: +1-703-262-5367

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] ExtensionClass and __radd__()?

2000-07-06 Thread Pavlos Christoforou

On Wed, 5 Jul 2000, Greg Ward wrote:

> 
> Well, it's a nice theory.  It doesn't explain why '__add__()' works for
> ExtensionClass while '__radd__()' does not; perhaps ExtensionClass
> implements that much of Python's class semantics, but doesn't go as far
> as '__radd__()'.
> 

A quick note which you probably already know:

grep add ExtensionClass.c gives:

static PyObject *py__add__, *py__sub__, *py__mul__, *py__div__,
  INIT_PY_NAME(__add__); BINOP(add,Add)
  FILLENTRY(nm->nb, add, add, METH_VARARGS, "Add to another");
  FILLENTRY(sm->sq, concat, add, METH_VARARGS,
  SET_SPECIAL(add,add); subclass_add(PyObject *self, PyObject *v)
  UNLESS(m=subclass_getspecial(self,py__add__)) return NULL;
  && AsCMethod(m)->meth==(PyCFunction)add_by_name
ASSIGN(m,AsCMethod(m)->type->tp_as_number->nb_add(self,v));
  (binaryfunc)subclass_add, /*nb_add*/
(binaryfunc)subclass_add, /*sq_concat*/
  return; /* we added a reference; don't delete now */ 

whereas grep radd ExtensionClass.c returns nothing


Pavlos


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )