Allow a box to be created from None
DaleStanbrough opened this issue · comments
Creating a Box with a parameter of None
results in an error.
BoxValueError: First argument must be mapping or iterable
The alternative is
Box(some_value or [])
which works to deliver an empty box.
The Box __init__
method could recognise this situation and create an empty Box instead.
This is actually done on purpose for safety to mimic how dict
operates.
>>> dict(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not iterable