A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-May/147828.html below:

[Python-Dev] __getattribute__'s error is not available in __getattr__

[Python-Dev] __getattribute__'s error is not available in __getattr__ [Python-Dev] __getattribute__'s error is not available in __getattr__Jason Maldonis jjmaldonis at gmail.com
Mon May 1 23:47:32 EDT 2017
Hi everyone,

If this should be asked in learn python I apologize -- please just tell me
without answering.

I'm working on a large class architecture and I find myself often
overloading __getattr__.  I am continuously running into the issue where I
want __getattr__ to have access to the error that was raised in
__getattribute__, but it seems completely unavailable. Is that true?

One simple case that I'm guessing others have run into, is if __getattr__
fails, the error from __getattribute__ isn't in the stack trace that gets
printed to screen.  To fix this (on occasion) I'll even re-call
__getattribute__ within __getattr__ just to get the error so I can properly
"raise from" the __getattibute__'s error -- although that's probably bad
practice in general.

I'd like to be able to access the error that was raised in __getattribute__
when __getattr__ is called.

Two more quick context comments: python is awesome, thank you all for your
hard work; and I've been writing python almost every day for ~ 5 years now
and I can do all the "black magic" jazz, so I'll be okay with an
implementation that requires that type of stuff if necessary.

Thanks!
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170501/8d7c2c12/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4