Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98964
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Writing SOME class methods in C |
| Date | 2015-11-18 12:52 +0000 |
| Message-ID | <mailman.412.1447851580.16136.python-list@python.org> (permalink) |
| References | <slrnn4obfa.db7.dh@dotcom.mfs32> |
On 18 November 2015 at 07:50, Daniel Haude <dh@dotcom.mfs32> wrote: > > I'm trying to implement some (but not all) methods of a Python class in C. > What I've found on the Net is: > - how to implement entire modules in C so that I can import that module and > use the C functions (successfully done it, too). > - how to implement entire classes in C I would suggest to use Cython here. You can write your class in Python (that will be compiled to C) and then call out to any C code from any of its methods. Alternatively Terry's suggestion to implement a class in C and then subclass it in Python to add the remaining methods is a good one. But then I would write the C class using Cython so I may as well do the whole thing in Cython. -- Oscar
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Writing SOME class methods in C Daniel Haude <dh@dotcom.mfs32> - 2015-11-18 07:50 +0000 Re: Writing SOME class methods in C Terry Reedy <tjreedy@udel.edu> - 2015-11-18 04:47 -0500 Re: Writing SOME class methods in C Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-11-18 12:52 +0000 Re: Writing SOME class methods in C Stefan Behnel <stefan_ml@behnel.de> - 2015-11-29 14:26 +0100
csiph-web