Message72805
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. |
|
Date |
User |
Action |
Args |
2008-09-08 23:17:34 | brett.cannon | set | recipients:
+ brett.cannon, barry, exarkun, pitrou, benjamin.peterson |
2008-09-08 23:17:33 | brett.cannon | link | issue3781 messages |
2008-09-08 23:17:33 | brett.cannon | create | |
|