variant

Discriminated Unions with boost::python and boost::variant - The Blind Guru

A useful application of boost::variant with boost::python by Mario Lang.

boost::python and boost::variant

by Mario Lang

From the post:

However, there is one aspect of C++ data types that I couldn't figure out how to interface with Python, which are C++ discriminated unions, or more specifically, heterogeneous containers. While Python has no problems with containers containing objects of different types, C++ does not make this very easy by default.