Java Objects vs Pythons?

Gordon McMillan gmcm at hypernet.com
Sat Jun 24 22:56:35 EDT 2000


Arinté wrote: 

[Gordon]
>> Without threads, none of these will do you any good. I guess you want
>> somebody to block while "waiting", but who (C++ or Python) or what
>> "waiting" means in this context, I don't know...
>>
>I want the script to ask the user for a certain action and until that
>user does  that action I want the script to halt.  Then when the user
>does the action the c++ app will catch the action and thru a callback
>tell the python script to continue on (I guess would be the best way).

Well, for this to work, there *must* be threads involved, because you have 
Python and C++ executing concurrently. In which case, you probably only 
need an Event (Python waits on the Event, and C++ "set"s it when ready). 
OTOH, if there aren't any threads, you'll have to transfer control somehow. 
Such as Python calls a C++ function (exposed to Python like you do in 
extending) that prompts the user, gets the input and returns to Python.

Or maybe you're in a GUI, and everything happens in response to mesages, in 
which case you probably want to break the Python into two pieces, the 
second of which gets called after the whatever has occurred.

or-maybe-not-ly y'rs

- Gordon



More information about the Python-list mailing list