def property_as_list ( self , property_name ) : try : res = self . _a_tags [ property_name ] except KeyError : return [ ] if type ( res ) == list : return res else : return [ res ]
property return list python
property () but encapsulates it in a list if it s a single - element property .
def property_as_list(self, property_name):
        """ property() but encapsulates it in a list, if it's a
        single-element property.
        """
        try:
            res = self._a_tags[property_name]
        except KeyError:
            return []

        if type(res) == list:
            return res
        else:
            return [res]