Skip to content

Commit 98ddba8

Browse files
authored
refactor: drop cpp (#402)
* refactor!: drop CPP module * refactor: removing BaseHistogram * refactor: Simplify axes
1 parent 8901037 commit 98ddba8

File tree

15 files changed

+89
-705
lines changed

15 files changed

+89
-705
lines changed

docs/api/boost_histogram.cpp.axis.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/api/boost_histogram.cpp.rst

Lines changed: 0 additions & 35 deletions
This file was deleted.

docs/api/boost_histogram.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ boost\_histogram
88

99

1010
.. include:: boost_histogram.axis.rst
11-
.. include:: boost_histogram.cpp.rst
1211

1312

1413
boost\_histogram.accumulators

docs/usage/comparison.rst

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Comparison with Boost.Histogram
44
===============================
55

66
``boost-histogram`` was based on the C++ library Boost.Histogram. In most ways,
7-
it mimics the interface of this library; if you learn to use one, you probably can use
8-
the other. A special high-compatibility mode is available with ``boost_histogram.cpp``,
9-
as well, which reduces the changes to a bare minimum. There are a few differences, however:
7+
it mimics the spirit of this library; if you learn to use one, you probably can use
8+
the other. There are a few differences, however, mostly around adhering to Python
9+
conventions:
1010

1111
Removals
1212
^^^^^^^^
@@ -21,14 +21,12 @@ The call operator
2121
fills are not encouraged in Python due to poor performance. The ``.fill`` method from
2222
Boost.Histogram 1.72 is bound, however - this provides fast fills without the drawbacks.
2323
If you want to fill with a single item, Python's ``.fill`` does support single item fills.
24-
``cpp`` mode does have a call operator.
2524

2625
Histogram make functions
2726
These functions, such as ``make_histogram`` and ``make_weighted_histogram``, are provided
2827
in Boost.Histogram to make the template syntax easier in C++14. In C++17, they are replaced
2928
by directly using the ``histogram`` constructor; the Python bindings are not limited by old
3029
templating syntax, and choose to only provide the newer spelling.
31-
``cpp`` mode does have the make functions.
3230

3331
Custom components
3432
Many components in Boost.Histogram are configurable or replaceable at compile time; since
@@ -37,20 +35,36 @@ Custom components
3735
Changes
3836
^^^^^^^
3937

38+
Naming
39+
The bindings follow modern Python conventions, with CamelCase for classes,
40+
etc. The Boost.Histogram library follows Boost conventions.
41+
4042
Serialization
41-
The Python bindings use a pickle based binary serialization, so cannot read files saved in C++ using Boost.Serialize.
43+
The Python bindings use a pickle-based binary serialization, so cannot read
44+
files saved in C++ using Boost.Serialize.
4245

4346
Properties
44-
Many methods in C++ are properties in Python. In ``cpp`` mode, most of these remain methods, except for ``.metadata``,
45-
which needs to be a property to allow it to be set.
47+
Many methods in C++ are properties in Python. ``.axis(i)`` is replaced with ``.axes[i]``.
48+
49+
Indexing
50+
The Python bindings use standard Python indexing for selection and setting.
51+
You can recover the functionality of ``.at(i)`` at endpoints with
52+
``bh.tag.at(i)``.
4653

54+
Renames
55+
The ``.rank()`` method is replaced by the ``.ndim`` property to match the common NumPy spelling.
4756

4857
Additions
4958
^^^^^^^^^
5059

5160
Unified Histogram Indexing
52-
The Python bindings support UHI, a proposal to unify and simplify histogram indexing in Python. Currently,
53-
this is disabled in ``cpp`` mode.
61+
The Python bindings support UHI, a proposal to unify and simplify histogram
62+
indexing in Python.
63+
64+
Custom transforms
65+
Custom transforms are possible using Numba or a C pointer. In
66+
Boost.Histogram, you can use templating to make arbitrary transforms, so a
67+
run time transform is not as necessary (but may be added).
5468

55-
Numpy compatibility
56-
The Python bindings do several things to simplify Numpy compatibility.
69+
NumPy compatibility
70+
The Python bindings do several things to simplify NumPy compatibility.

0 commit comments

Comments
 (0)