Closed DaleStanbrough closed 2 years ago
Creating a Box with a parameter of None results in an error.
None
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.
__init__
This is actually done on purpose for safety to mimic how dict operates.
dict
>>> dict(None) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'NoneType' object is not iterable
Creating a Box with a parameter of
None
results in an error.The alternative is
which works to deliver an empty box.
The Box
__init__
method could recognise this situation and create an empty Box instead.