Robert, this is definitely a good idea, but I would object it being
enabled by default. If it is enabled in a way like the current
'__weakref__' way, then that would be fine (IMHO , and once again,
explicit is better than implicit). And finally, if a user want to do
himself the full implementation like in my example, then Cython should
just ignore its 'default' way and respect user implementation.

On 5/27/08, Robert Bradshaw <[EMAIL PROTECTED]> wrote:
> On May 27, 2008, at 2:27 PM, Lisandro Dalcin wrote:
>
>  > On 5/27/08, Eric Jonas <[EMAIL PROTECTED]> wrote:
>  >> To start with, this is awesome. Thank you so much!
>  >>
>  >>  Next question: What if I want MyPair to have a zero-argument
>  >>  constructor? (Well, besides self, that is). If I do:
>  >>
>  >>  class MyPair(pair):
>  >>    def __init__(self):
>  >>        pass
>  >>
>  >>  then I get "TypeError: ('__init__() takes exactly 1 argument (3
>  >> given)".
>  >>  Does this mean that derived types must always have constructors
>  >> with the
>  >>  same number (or more) than their base type?
>  >
>  > Yes and No. The problem is that different pickle protocols assume and
>  > do different things. Give me some minute, I'll try to figure out
>  > what's going on. And yes, you are right, this is a real crap if you
>  > want so support in a easy way all pickle protocols, plus class
>  > inheritance.
>
>
> On this note, I think Cython should be able to provide a default
>  __reduce__ that will "just work" for cdef classes, the way normal
>  pickling works in Python without having to think about it. Of course,
>  one should always be able to override it manually, and if the class
>  has specially-typed members than it may take a bit more work.
>
>
>  - Robert
>
>
>  _______________________________________________
>  Cython-dev mailing list
>  [email protected]
>  http://codespeak.net/mailman/listinfo/cython-dev
>


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to