From 25e22e31dfd49bfa3c52d977d222e38877c5c093 Mon Sep 17 00:00:00 2001 From: Dmitry Medvinsky Date: Tue, 8 Jan 2013 18:23:14 +0400 Subject: [PATCH] Use `getattr` with default instead of `if hasattr/else` --- gunicorn/util.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gunicorn/util.py b/gunicorn/util.py index ad4931d0..82cd3251 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -31,10 +31,7 @@ import warnings from gunicorn.six import text_type, string_types MAXFD = 1024 -if (hasattr(os, "devnull")): - REDIRECT_TO = os.devnull -else: - REDIRECT_TO = "/dev/null" +REDIRECT_TO = getattr(os, 'devnull', '/dev/null') timeout_default = object()