@@ -91,7 +91,7 @@ def __init__(self, *axes, **kwargs):
9191
9292 If you pass in a single argument, this will be treated as a
9393 histogram and this will convert the histogram to this type of
94- histogram (DensityHistogram, Histogram, BoostHistogram) .
94+ histogram.
9595
9696 Parameters
9797 ----------
@@ -104,21 +104,23 @@ def __init__(self, *axes, **kwargs):
104104 """
105105
106106 # Allow construction from a raw histogram object (internal)
107- if not kwargs and len (axes ) == 1 and isinstance (axes [0 ], _histograms ):
107+ if len (axes ) == 1 and isinstance (axes [0 ], _histograms ):
108108 self ._hist = axes [0 ]
109- self .metadata = None
109+ self .metadata = kwargs . get ( "metadata" )
110110 self .axes = self ._generate_axes_ ()
111111 return
112112
113113 # If we construct with another Histogram, support that too
114- if not kwargs and len (axes ) == 1 and isinstance (axes [0 ], Histogram ):
114+ if len (axes ) == 1 and isinstance (axes [0 ], Histogram ):
115115 self .__init__ (axes [0 ]._hist )
116116 self .metadata = axes [0 ].metadata
117117 return
118118
119119 # Keyword only trick (change when Python2 is dropped)
120120 with KWArgs (kwargs ) as k :
121- storage = k .optional ("storage" , Double ())
121+ storage = k .optional ("storage" )
122+ if storage is None :
123+ storage = Double ()
122124 self .metadata = k .optional ("metadata" )
123125
124126 # Check for missed parenthesis or incorrect types
@@ -160,8 +162,7 @@ def _new_hist(self, _hist):
160162 Return a new histogram given a new _hist, copying metadata.
161163 """
162164
163- other = self .__class__ (_hist )
164- other .metadata = self .metadata
165+ other = self .__class__ (_hist , metadata = self .metadata )
165166 return other
166167
167168 @property
0 commit comments