3dcheapskate opened this issue on Sep 26, 2020 ยท 7 posts
an0malaus posted Sat, 03 October 2020 at 7:48 AM
It's also worth noting that BOTH None and '' (empty string) evaluate to False in a boolean expression. That provides a simple way to distinguish between a useful returned string to be parsed (any non-empty string will evaluate as True) and a non-selection ('' OK) or cancellation (None). Python design has its own logic, and it takes some getting used to when coming from other languages.
Similarly with lots of other Poser Python API methods which can return None instead of an empty list. As in adp's second example, if a method could return None instead of an empty list, make use of None evaluating as False, and iterate over a list conditional like:
for item in ListMethodThatMayReturnNone() or []: # The " or []" CAN be iterated over without error, while None cannot
pass
Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.