[Python-Dev] getattribute's error is not available in getattr (original) (raw)
Jason Maldonis jjmaldonis at gmail.com
Mon May 1 23:47:32 EDT 2017
- Previous message (by thread): [Python-Dev] Request review of cProfile/profile series issue
- Next message (by thread): [Python-Dev] __getattribute__'s error is not available in __getattr__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Previous message (by thread): [Python-Dev] Request review of cProfile/profile series issue
- Next message (by thread): [Python-Dev] __getattribute__'s error is not available in __getattr__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]