Brett Cannon <[EMAIL PROTECTED]> added the comment: The use of __getattr__ is a historical artifact. Originally there was no way to record multiple warnings as the object returned by catch_warnings() represented only a single instance of a warning. But then the ability to record multiple warnings was added. To not break existing code (I am guessing), the setting of attributes on the WarningsRecorder was added. To tawdry life of catch_warnings(). =)
While having the attributes of the last warning directly accessible is handy, I am in no way married to the idea. Actually, if we run with the list analogy we can just ditch WarningsRecorder and return a list itself that is directly appended to through a version of showwarning() that is a closure instead. That cuts out code and everyone knows how to work with lists as sequential recording of events. OK, I'm sold. =) I will work on this today or tomorrow and get the patch done and ready to go no later than Sunday evening for review. _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3781> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com