I would then write my implementation in a PYX file and all should be well.
I can get this to work with SWIG without problems, but I am getting
progressively more annoyed with SWIG in general and am hoping to move all
my SWIG code to cython and get rid of SWIG entirely throughout all my
projects.
> I would then write my implementation in a PYX file and all should be well.
Hmm, you mean that you want to implement these in Cython and export them to
other modules? This is not about wrapping C++ implemented code, right?
Cython doesn't currently support this. You can use optional arguments in
cdef functions, though.
Such a feature can't be hard to add, given that we have already support for
C++ types anyway. You wouldn't declare a cname though (your "Props" string
above), Cython would mangle the internal names for you. However, exporting
them so that other modules can use them might turn out to be tricky because
all Cython versions you use would have to come up with the same mangled
public name.
> I would then write my implementation in a PYX file and all should be well.
> I can get this to work with SWIG without problems, but I am getting
> progressively more annoyed with SWIG in general and am hoping to move all my
> SWIG code to cython and get rid of SWIG entirely throughout all my projects.
On Tue, Aug 7, 2012 at 3:45 AM, Stefan Behnel <stefan...@behnel.de> wrote:
> Ian Bell, 07.08.2012 05:55:
> > Is there any way to do overloaded functions in cython? I have a PXD file
> > that demonstrates what I am trying to do:
> > I would then write my implementation in a PYX file and all should be
> well.
> Hmm, you mean that you want to implement these in Cython and export them to
> other modules? This is not about wrapping C++ implemented code, right?
> Yeah, that is exactly what I want to do. I could probably live without
exporting them, but if I compile a file as a PYX file, I lose the ability
to do something like::
Props(*args)
and then select the right function signature based on the form of args.
Also this will take a significant speed penalty since I need to be doing
type comparison, and this is a function that gets called quite a few
million times, so performance is of the utmost importance.
> Cython doesn't currently support this. You can use optional arguments in
> cdef functions, though.
Optional, yes, but so far as I am aware, no way to do something like
> Such a feature can't be hard to add, given that we have already support for
> C++ types anyway. You wouldn't declare a cname though (your "Props" string
> above), Cython would mangle the internal names for you. However, exporting
> them so that other modules can use them might turn out to be tricky because
> all Cython versions you use would have to come up with the same mangled
> public name.
On Tue, Aug 7, 2012 at 12:39 PM, Ian Bell <ian.h.b...@gmail.com> wrote:
> On Tue, Aug 7, 2012 at 3:45 AM, Stefan Behnel <stefan...@behnel.de> wrote:
>> Ian Bell, 07.08.2012 05:55:
>> > Is there any way to do overloaded functions in cython? I have a PXD
>> file
>> > that demonstrates what I am trying to do:
>> > I would then write my implementation in a PYX file and all should be
>> well.
>> Hmm, you mean that you want to implement these in Cython and export them
>> to
>> other modules? This is not about wrapping C++ implemented code, right?
>> Yeah, that is exactly what I want to do. I could probably live without
> exporting them, but if I compile a file as a PYX file, I lose the ability
> to do something like::
> Props(*args)
> and then select the right function signature based on the form of args.
> Also this will take a significant speed penalty since I need to be doing
> type comparison, and this is a function that gets called quite a few
> million times, so performance is of the utmost importance.
>> Cython doesn't currently support this. You can use optional arguments in
>> cdef functions, though.
> Optional, yes, but so far as I am aware, no way to do something like
> cpdef double Props(*args):
>> Such a feature can't be hard to add, given that we have already support
>> for
>> C++ types anyway. You wouldn't declare a cname though (your "Props" string
>> above), Cython would mangle the internal names for you. However, exporting
>> them so that other modules can use them might turn out to be tricky
>> because
>> all Cython versions you use would have to come up with the same mangled
>> public name.
>> Stefan
> For others that follow, what I ended up doing was to just create a shim