Help embedding python

Zora Honey zhoney at wildmail.com
Mon Aug 25 15:14:11 EDT 2003


Peter Hansen wrote:
> Zora Honey wrote:
> 
>>Peter Hansen wrote:
>>
>>>Zora Honey wrote:
>>>
>>>
>>>>My husband and I are writing a program that does a lot of math behind
>>>>the scenes (c++) with a gui front (python/Tkinter).  We've decided that
>>>>we want the c++ to be the "driver", and so we want to embed the python.
>>>
>>>
>>>It's a little unclear (to me) exactly what you're trying to do,
>>>but in any case I can't imagine why you'd want to have C++ "drive"
>>>the Python code (if that's what you meant by "driver", as opposed to
>>>the more common sense as in "device driver") instead of the other
>>>way around.
>>>
>>>And my inability to imagine why you want this is compounded by your
>>>choice of Python and Tkinter for the front end.  It is much more
>>>common to have the front end be the "driving" code, and the back end
>>>be "driven", especially in CPU-intensive applications as it sounds
>>>like you have here.
>>>
>>>-Peter
>>
>>Okay.  Let's assume that the choice to embed the python was a
>>well-reasoned decision.  Or assume that I want to embed some python for
>>the pure joy of doing so.  Can you help?
> 
> 
> No, sorry.  I have no particular expertise in embedding Python in a
> C++ application in the way you wish.
> 
> (If I did, and I had an easy answer, I would offer it.  If, on the other hand,
> I had no easy answer, and it was going to take some effort on my part,
> I'd be happy to provide that effort if the person I was helping would
> take a moment of his/her time to convince me that it was a well-reasoned 
> decision.  If, on the other hand, the decision was based on ignorance
> or merely on a frivolous desire to experience the joy of doing so at the 
> cost of another's valuable time, I would probably be less inclined to help...)
> 
> (If you assume for a moment that the person who actually *can* help you
> might feel somewhat the same way, you might take a moment to explain
> the background rather than risk looking like you treat others' time as 
> less valuable than your own.  It may not look that way to you, but I
> was merely trying to help by showing you that at least one person was
> puzzled by your choice.  I'm also always interested in learning, so 
> I'd still be quite interested in your rationale, if you are willing to
> provide it.)
> 
> Cheers,
> -Peter


I'm sorry if I was a bit curt.  The reason I didn't include rationale is 
because I have none.  I have been advocating extending python instead of 
embedding it, but since I have no experience with either, my only 
argument is that it seems more natural.  It seems like either method is 
as difficult to learn and implement.  It doesn't seem to me that there 
are lot of arguments one way or the other.  My husband, on the other 
hand, is strongly attached to the idea of having a c++ main program that 
will coordinate all the data-processing classes and python widgets. He 
believes it is easier to have c++ say to python, "here, I have these 
plots for you," rather than have python say to c++, "make these plots 
for me."  I don't believe this is true, but I don't have any reason 
*not* to believe it's true, so I aquiesced.

So, I suppose instead of asking you to assume the rationale are well 
reasoned, I should be asking you why you believe extending python is 
easier/cheaper/faster/better than embedding it.

Thank you,
Zora

(who's hoping hubby isn't reading this newsgroup today)





More information about the Python-list mailing list