param
param copied to clipboard
Array should not force `allow_None=True`
As mentioned by @jlstevens in https://github.com/holoviz/param/pull/582 , it's odd that an Array parameter forces allow_None to True:
class Array(ClassSelector):
"""
Parameter whose value is a numpy array.
"""
def __init__(self, default=None, **params):
from numpy import ndarray
super(Array, self).__init__(ndarray, allow_None=True, default=default, **params)
I'm guessing that the original reason for that was to make the code able to work when NumPy is not available, but because we always assume allow_None to be True if the default is None, here having a None default should be sufficient already, without forcing all Array instances to allow None. Fixing this will be a breaking change, since any user of Array that does want to allow None will now have to supply that flag explicitly, but it seems the right thing to do.