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, benjamin.peterson, brett.cannon, exarkun, pitrou
Date 2008-09-08.23:17:33
SpamBayes Score 1.1837644e-09
Marked as misclassified No
Message-id <bbaeab100809081617y64090161q82c24fbdb4eb3193@mail.gmail.com>
In-reply-to <1220911962.24.0.468099971845.issue3781@psf.upfronthosting.co.za>
Content
On Mon, Sep 8, 2008 at 3:12 PM, Benjamin Peterson
<report@bugs.python.org> wrote:
>
> Benjamin Peterson <musiccomposition@gmail.com> added the comment:
>
> The patch mostly looks good. However, all the w[-1] logic looks rather
> verbose to me since its main use case in testing will be making sure
> *one* warning happened. Returning a list adds the extra step of checking
> the length and then indexing it for the warning validation. I'm not
> completely suggesting that you bring back the smart list, but maybe an
> option on catch_warning to just yield the WarningMessage on __enter__.
>

Well, the real question is whether most users will use this for
testing, or for temporarily suppressing warnings. The stdlib is not a
normal use-case in this regard since we have to be so careful with
giving deprecations.

I honest don't fine the [-1] indexing that bad and I had to add all of
them. =) Makes it explicit you are assuming there is at least one
warnings (and probably only one) and you should check that there was
not an extra one.

I will wait to see if Barry has anything to say on the matter since he
pushed for the change.
History
Date User Action Args
2008-09-08 23:17:34brett.cannonsetrecipients: + brett.cannon, barry, exarkun, pitrou, benjamin.peterson
2008-09-08 23:17:33brett.cannonlinkissue3781 messages
2008-09-08 23:17:33brett.cannoncreate