Snake Charming with (or Integrating and Python)

Author: Guy Shepherd


Python, and Python-like languages, such as Haskell, Clojure, Scala, Julia and Erlang have seen increased use in the financial modelling arena over recent years and is now part of the standard toolkit for many applications.

This is partly due to the ease in which relatively complex financial modelling algorithms can be implemented within Python using a wide array of additional libraries dedicated to solving specific problems and use cases.  Some of the most common additional libraries used by financial modellers include numpy, scipy, pandas, and tensorflow.

In turn, this allows developers with relatively limited programming experience or technical knowledge to embark on solving problems that might be seen as more challenging or out of reach with other platforms.  This is largely because the functional complexity of the solution has been embedded in libraries and the developer only needs a basic understanding of the library and its interfaces in order to harness their power.

Finally, there is a growing community of Python experts who are always keen to show how clever they are in solving any new challenge that appears.

This series of articles will explore how and Python can be integrated in a range of different ways to meet a multitude of potential use cases.

Strengths and Weaknesses

Python has its strengths, especially when it comes to prototyping or R&D activity.  These include:

  • Simple and easy to learn – syntax which is relatively easy to understand
  • Interpreted language – the effect of changes to code can immediately be seen
  • Cross-platform language – not tied to any specific platform or architecture
  • Free and open source – accessible to all / low barrier to use
  • Flexibility – can enable solutions for a multitude of applications & use cases

But, it also some specific weaknesses which often inhibit its use in an operational environment.  These include:

  • Speed – the flip side of being an interpreted high-level language is that it’s relatively slow and difficult to parallelise effectively
  • Code structure – in Python scope / loop delimiting is done with whitespaces rather than with braces or keywords (BEGIN / END), which is hardly robust
  • Dynamic typing – this makes anything but the most simplest programs very cumbersome and incredibly resource intensive for even quite modest programs
  • Object orientation – Python’s implementation of object orientation has some frustrating quirks for seasoned developers, such as the lack of private instance variables
  • Lack of constants – Python has no concept of constants, which is almost unique across all mainstream languages

Playing Nicely Together

Despite the shortcomings of Python, there is certainly merit in considering the integration of and Python to solve specific business problems and benefit from the tangible benefits of each platform.  By leveraging the integration capability of, existing Python scripts can simply be reused within models and tasks without any refactoring.  Similarly, the open architecture of the platform allows existing models to be within a Python script, although the use cases for this might be less obvious.  And finally, with a little more effort, Python functions & libraries can also be used within a project, which might be of interest if a specific function already exists in a Python library and the developer doesn’t have the appetite to write or find a equivalent.

Each of these options will be explored in detail in the remaining articles in this series.

Was this article helpful?

Your email address will not be published. Required fields are marked *