Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38220
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'interpreter': 0.04; '(using': 0.07; 'arguments': 0.07; 'chunk': 0.07; 'python': 0.09; 'booth': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'subject:python': 0.11; 'library': 0.15; 'result.': 0.15; 'algorithm.': 0.16; 'iteration': 0.16; 'readable': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'wrote:': 0.17; 'config': 0.17; 'library,': 0.17; 'variables': 0.17; 'jan': 0.18; 'ctypes': 0.22; "user's": 0.22; 'help.': 0.22; 'runs': 0.22; 'external': 0.24; 'command': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'am,': 0.27; 'done.': 0.27; 'embedded': 0.27; 'header:X-Complaints-To:1': 0.28; 'loop,': 0.29; 'convert': 0.29; 'function': 0.30; 'code': 0.31; 'implement': 0.32; 'to:addr :python-list': 0.33; 'another': 0.33; 'done': 0.34; 'subject:?': 0.35; 'there': 0.35; 'received:org': 0.36; 'method': 0.36; 'enough': 0.36; 'turn': 0.36; 'option': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'more': 0.63; 'finally': 0.66; 'life': 0.66; 'direct': 0.69; 'advantages': 0.71; 'sounds': 0.71; 'received:fios.verizon.net': 0.84; 'start.': 0.84; 'subject:system': 0.84; 'production,': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: real-time monitoring of propriety system: embedding python in C or embedding C in python? |
| Date | Tue, 05 Feb 2013 14:33:28 -0500 |
| References | <e13b91a6-e409-440a-ac96-91df67c832c4@googlegroups.com> <XnsA15E9C9C99379duncanbooth@127.0.0.1> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-251-66.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| In-Reply-To | <XnsA15E9C9C99379duncanbooth@127.0.0.1> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1382.1360092837.2939.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1360092837 news.xs4all.nl 6867 [2001:888:2000:d::a6]:38779 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:38220 |
Show key headers only | View raw
On 2/5/2013 10:23 AM, Duncan Booth wrote: > Bas <wegwerp@gmail.com> wrote: > >> A) Implement the main program in C. In a loop, get a chunk of data >> using direct call of C functions, convert data to python variables and >> call an embedded python interpreter that runs one iteration of the >> user's algorithm. When the script finishes, you read some variables >> from the interpreter and then call some other C-function to write the >> results. >> >> B) Implement the main loop in python. At the beginning of the loop, >> you call an embedded C function to get new data (using ctypes?), make >> the result readable from python (memoryview?), do the user's >> calculation and finally call another C function to write the result. >> >> Are there any advantages for using one method over the other? Note >> that I have more experience with python than with C. > > Option B sounds like it makes your life simpler. Just turn the external > code into a library, use ctypes to call the library and you're done. That > also means reading command line arguments and/or config files can be done > in Python and keep the C code simpler. This is exactly how I would start. If this is not fast enough for production, Cython may help. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
real-time monitoring of propriety system: embedding python in C or embedding C in python? Bas <wegwerp@gmail.com> - 2013-02-05 07:10 -0800
Re: real-time monitoring of propriety system: embedding python in C or embedding C in python? Duncan Booth <duncan.booth@invalid.invalid> - 2013-02-05 15:23 +0000
Re: real-time monitoring of propriety system: embedding python in C or embedding C in python? Terry Reedy <tjreedy@udel.edu> - 2013-02-05 14:33 -0500
Re: real-time monitoring of propriety system: embedding python in C or embedding C in python? rusi <rustompmody@gmail.com> - 2013-02-05 08:14 -0800
Re: real-time monitoring of propriety system: embedding python in C or embedding C in python? Stefan Behnel <stefan_ml@behnel.de> - 2013-02-05 19:19 +0100
csiph-web