In addition to performance reasons indicated by someone, I’d point also to maintainability, mostly thanks to a well devised type system. I’m not a Python user, so please do correct me if I’m wrong anywhere, but I’ve got the feeling that it’s often tricky to make two classes from different packages play nicely together. At least, some glue code is sometimes required.
In this regard, I find the example of my package Measurements.jl
instructive. There is a similar Python package: uncertainties
. They’re both uncertainty propagation library, but they have different support for some features:
- complex numbers.
uncertainties
: not supported.Measurements.jl
: work out-of-the-box. - arbitrary precision.
uncertainties
: not supported.Measurements.jl
: work out-of-the-box. - arrays of numbers with uncertainty and operation with them.
uncertainties
: support to NumPy thanks to a submodule written for the purpose.Measurements.jl
: work out-of-the-box. - linear algebra operations with matrices:
uncertainties
: limited support: a submodule written for the purpose provide methods to compute matrix inverse and pseudo-inverse.Measurements.jl
: those operations defined for anyAbstractFloat
work out-of-the-box, things will improve if/when issue #5429 will be fixed. Note this is not a limitation of the language, it’s simply that we need someone who writes the methods for generic types. - operations with numbers with uncertainty and physical units.
uncertainties
: you have to write glue code, Pint package does this.Measurements.jl
: works out-of-the-box with any type providing unit feature, see Examples — Measurements.jl 0.4.1-dev documentation. - numerical integration.
uncertainties
: not supported.Measurements.jl
:quadgk
fromQuadGK.jl
already works out-of-the-box with functions returning arbitrary types, includingMeasurement
. InMeasurements.jl
I only taughtquadgk
the derivatives of the integral with respect to the interval bounds, so that one can use alsoMeasurement
objects as endpoints of the integral.
When I say that Measurements.jl
works out-of-the-box I mean that I didn’t add any single line of code to get that feature. They all came for free during development. This is a huge leap for the developer, and users as well (see second last point: Measurements.jl
, nor the physical units packages, doesn’t impose a choice on the user, they can use whatever package they like).