Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36878 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2013-01-15 17:01 -0700 |
| Last post | 2013-01-15 17:01 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2013-01-15 17:01 -0700 |
| Subject | Re: Is there a more elegant way to handle determing fail status? |
| Message-ID | <mailman.557.1358294500.2939.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web