This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients barry, brett.cannon, exarkun, pitrou
Date 2008-09-06.18:24:21
SpamBayes Score 0.0052147997
Marked as misclassified No
Message-id <1220725462.58.0.570006838265.issue3781@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-09-06 18:24:22brett.cannonsetrecipients: + brett.cannon, barry, exarkun, pitrou
2008-09-06 18:24:22brett.cannonsetmessageid: <1220725462.58.0.570006838265.issue3781@psf.upfronthosting.co.za>
2008-09-06 18:24:21brett.cannonlinkissue3781 messages
2008-09-06 18:24:21brett.cannoncreate