title: Calling Python from .NET via C++ bridge
body: <p>Once per a couple of months I google for "Call Python from .NET" when I am too tired to reinvent/port stuff and find some cool code in Python. The two popular solutions are to start an external process or to use IronPython</p>
  
  <p>IronPython is not an option for me since the reason I might want to use Python is usually some libraries that depend on NumPy/ScyPy.</p>
  
  <p>Recently I started to learn the very basics of C++ and have found that one could embed Python in C++, and have found an <a href="http://www.codeproject.com/Articles/11805/Embedding-Python-in-C-C-Part-I" rel="nofollow">article with an example</a>.</p>
  
  <p>Calling C++ from .NET is very easy via P/Invoke. So my scenario is to call some Python script with data from .NET and get results back.</p>
  
  <p>Before I start digging deeper I want to ask if someone has tried this approach, is this feasible or there are better ways?</p>
  
  <p>Specifically,</p>
  
  <ul>
  <li>Will all Python libs work when embedded, e.g. NumPy, ScyPy, Pandas, PyMC, etc.?</li>
  <li>Will embedded Python work with C++/CLI in the same way as with standard C++?</li>
  <li>How to pass complex data to Python: serialized to JSON or there is a mapping between types?</li>
  </ul>
  
  <p>Performance is a concern: the main use case is to do some numeric work on a sliding window of real time data. I think external process is very slow for frequent calls - please correct me if I am wrong?</p>