May-06-2021, 01:50 PM
(This post was last modified: May-06-2021, 01:51 PM by Gribouillis.)
I don't know what the 'preset' instance is, but when objects have a get() method, this method often has a default argument. You could use this default argument. Example with dictionaries
>>> spam = {} >>> spam.get('last') >>> spam.get('last', '') '' >>> spam.get('last', '').isdigit() False >>> spam.get('last').isdigit() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'isdigit'