Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36878
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.068 |
| X-Spam-Evidence | '*H*': 0.86; '*S*': 0.00; 'exit': 0.07; 'keyed': 0.09; 'properly': 0.15; 'orderable': 0.16; 'wrote:': 0.17; 'implementing': 0.17; 'variables': 0.17; 'jan': 0.18; 'keys': 0.22; '15,': 0.23; 'header:In-Reply-To:1': 0.25; '(e.g.': 0.27; 'first,': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; 'second,': 0.29; "skip:' 10": 0.30; 'code': 0.31; 'to:addr :python-list': 0.33; 'that,': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'fail': 0.35; 'pm,': 0.35; 'subject:?': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'but': 0.36; 'level.': 0.36; 'level': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'subject:there': 0.65; '2013': 0.84; 'subject:handle': 0.84; 'subject:status': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=yTTMEBNS9dPbLwA21i2wKhkpdNow24pwM0/rFN06QZg=; b=JIT1QBvX9/xp5DGSzy6juBcXkSFeteMcaujZGu5B7iVA/dRceVma87XOAJds81wHCp jtBaTI2fOXVml4+7n24kfW0w8vqPsxy+BWg1RBBuXQ/5jojTClzAZQQOjsy9Sfz4D/pk TaOm3CeeM35pFHpeejQeOi/IFRVkLddTxhJoBn5OJ4iImVLxIdw35p8Kjrd6RANjFKAq /v4eRxz9a5ha5Vl+sGrfi6Z5okNzYmS2lCbK1ZZhymWYvDf3wcVrn69EcVcYwlLnd9aN xzB+Jz61EF5QMdU8uw2yrxXetw12vDZ9HXoH1S6sN/VGxZqRcJjwCHqWUVHLWM9rOTud hoRA== |
| MIME-Version | 1.0 |
| In-Reply-To | <CAFB6qZtPFQh-pwNRw0gL_wb15gZ2GMK+y=ugrtGe5DqRTo1PCQ@mail.gmail.com> |
| References | <CAFB6qZtPFQh-pwNRw0gL_wb15gZ2GMK+y=ugrtGe5DqRTo1PCQ@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 15 Jan 2013 17:01:07 -0700 |
| Subject | Re: Is there a more elegant way to handle determing fail status? |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.557.1358294500.2939.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358294500 news.xs4all.nl 6882 [2001:888:2000:d::a6]:42169 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36878 |
Show key headers only | View raw
On Tue, Jan 15, 2013 at 4:24 PM, J <dreadpiratejeff@gmail.com> wrote:
> The exit code determination above works, but it just feels inelegant.
> It feels like there's a better way of implementing that, but I can't
> come up with one that still honors the fail level properly (e.g. other
> solutions will fail on medium, but won't fail properly on medium OR
> higher).
First, instead of having separate variables 'critical_fails',
'high_fails', etc., put them in a collections.Counter 'fails' keyed by
fail level.
Second, make sure those fail level keys are orderable by severity.
Then your check is just:
if fail_priority <= max(fails):
return 1
return 0
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Is there a more elegant way to handle determing fail status? Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-15 17:01 -0700
csiph-web