How to get which attribute causes the AttributeError except inspecting strings?
Mark Lawrence
breamoreboy at yahoo.co.uk
Mon Mar 7 12:26:11 EST 2016
On 07/03/2016 16:38, Tim Golden wrote:
> On 07/03/2016 16:25, Xiang Zhang wrote:
>> Hi,
>>
>> I know I can get the attribute name in some way, but since I just
>> want the attribute name when an AttributeError caused by it raised, I
>> really don't want to inspect the string or introduce one more layer
>> over getattr. I hope I can get the attribute which causes the
>> exception from the AttributeError raised directly. But it seems I
>> can't.
>>
>
> As things stand, you can't. But if you were to chime in on this issue:
>
> https://bugs.python.org/issue18156
>
> then you might bring discussion there back to life again and see some
> forward movement. There seemed to be a consensus (and involving some
> active developers) so it's possible that new interest might revive interest.
>
> TJG
>
Thanks, you saved me searching for the link that I knew existed :)
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-list
mailing list