In python3, when I write code like this: try: fields = [getattr(Product, field) for field in fields.split(',')] except AttributeError as e: raise HTTPError(...)
I want to raise a new type of error giving a string telling the user which attribute is not valid. But I don't see any method I can use to get the attribute name except inspecting e.args[0]. Could anyone give me a hint? Maybe I miss something. By the way, I don't quite want to change my code to a for-loop so I can access the field variable in exception handling. -- https://mail.python.org/mailman/listinfo/python-list