Polyglot Programming with Python: Python/Scala Interop

Audience level:
March 10th 4 p.m. – 4:55 p.m.


I won't just demonstrate how to use projects that bridge programming languages, I'll walk through the lower-level code that allows inter-language communication to happen.


This talk is written to engage developers interested in exploring the different forms that polyglot programs can take. The examples all demonstrate techniques for integrating Python with Scala, but the concepts are applicable beyond the specific use case of Python/Scala interop, and the talk does not assume prior knowledge of Scala.

Topics include:

  • Brief intro to Scala (enough to be able to follow the examples)
  • Basic script hosting APIs
  • Python/Scala integration via Jython
  • JEPP (CPython/JVM bridge)
  • Leveraging Python’s support for metaprogramming to make foreign function calls virtually indistinguishable from host language function calls
  • Passing a Python function to a Scala function that takes a Scala function as an argument
  • Interface Definition Language (IDL) and IDL-based strategies
  • Using TCP for inter-language communication

Attendees should be familiar Python's metaprogramming capabilities because I won’t be providing background information about adding or modifying attributes dynamically or interrogating a Python object for attribute details.