Hi,
Dag Sverre Seljebotn wrote:
> Danilo Freitas wrote:
>> For my GSoC work with C++ Support, I need to know if we'll use the
>> Python '__init__' special method or use C++ way, with the constructor
>> with the same name of the class:
>>
>> class Foo
>> {
>> public:
>> Foo() { } //constructor
>> }
>
> Well, what is the syntax going to be for other operators? I.e. I would
> think you could have either
>
> cdef extern cppclass Foo: # or whatever
> Foo(int a, int b)
> Foo operator+(Foo other)
>
> or
>
> cdef extern cppclass Foo:
> def __init__(self, int a, int b)
> def Foo __add__(self, Foo other)
>
> or
>
> cdef extern cppclass Foo:
> cdef __init__(self, int a, int b)
> cdef Foo __add__(self, Foo other)
>
> but I wouldn't feel happy about a mixture of those.
+1 for XOR. Given that the semantics are not necessarily what one would
expect from a Python __add__, and given that we need a way to support
overloaded signatures anyway, I'm +0.5 for a syntax that differs from
Python, such as the above "operator+". Developers who use this feature must
be familiar with C++ syntax anyway, so keeping the declarations close to
C++ is a plus (pun intended).
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev