[Python-ideas] The AttributeError/__getattr__ mechanism

Chris Angelico rosuav at gmail.com
Sun Nov 29 13:34:19 EST 2015


On Mon, Nov 30, 2015 at 5:10 AM, 王珺 <wjun77 at gmail.com> wrote:
>> A dedicated subclass of AttributeError to trigger __getattr__ is more
>> natural.
> I mean it's unnatural to convert AttributeError to AttributeDynamicError by
> property or descriptor. Why not use RuntimeError as that of PEP479?
>

Earlier I posted some example code that would do exactly that. If an
AttributeError would escape a property function, it becomes a
RuntimeError. Does that do what you're looking for?

ChrisA


More information about the Python-ideas mailing list