Changes bare try/except to callable check.

This commit is contained in:
Johnny 2022-08-05 19:41:39 +00:00
parent 86fcdf4528
commit 470c2ebef7

View file

@ -176,7 +176,7 @@ class AttributeProperty:
attrhandler_name = "attributes" attrhandler_name = "attributes"
def __init__(self, default=None, category=None, strattr=False, lockstring="", autocreate=True): def __init__(self, default=None, default_factory=None, category=None, strattr=False, lockstring="", autocreate=True):
""" """
Initialize an Attribute as a property descriptor. Initialize an Attribute as a property descriptor.
@ -209,9 +209,9 @@ class AttributeProperty:
Tries returning a new instance of default if callable. Tries returning a new instance of default if callable.
""" """
try: if callable(self.__default):
return self.__default() return self.__default()
except:
return self.__default return self.__default
@_default.setter @_default.setter