The easiest way to connect languages ββis to communicate through a socket, such as a TCP / IP or Unix socket, or through a high-level protocol such as HTTP or XML-RPC. This is associated with very high overhead, although due to query processing and serialization / deserialization to / from JSON / XML, which can be significant if you need to make a lot of calls. Socket communication is usually best if the workload of the request is high.
If you don't want to pay for socket overhead (say if you make thousands of requests back and forth between python and go in seconds), there are other solutions that may have less overhead. You might be able to use shared memory in OSs that have them. Shared memory usually incurs a much cheaper cost of data access, but it can incur the cost of boxing / unpacking from the general memory structure to Python data types. Also, note that you may need to operate the locks yourself.
If you make only a very small number of calls, and they do not need to share between states between calls, I would not recommend communicating using the standard stdin / stdout.
The final alternative is to write a Python Extension; I would not recommend this for the faint of heart.
Lie ryan
source share