tools-python icon indicating copy to clipboard operation
tools-python copied to clipboard

has_optional_field implementation may lead to unexpected results

Open xavierfigueroav opened this issue 5 years ago • 1 comments

has_optional_field(field) verifies whether the value of field is not None. But, some attributes are sometimes initialized as some default/empty object, like an empty list. In that example, has_optional_field(field) will always return True, even if the list is empty (when I think it should return False because there is actually no information).

I suggest: return bool(field)

xavierfigueroav avatar Mar 20 '19 05:03 xavierfigueroav

Can I work on this issue ?

b-thebest avatar Mar 04 '21 17:03 b-thebest