Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15736

Re: suppressing import errors

References (1 earlier) <CALvWhxvc=Ng28YeiL0Onv9YCixfQtOqgLENWJqYgoRSYvo_juA@mail.gmail.com> <CAC82khn3WBjXY7podVq6RX0d0j38w1vbtN3fNOCSGLcu2X_jOw@mail.gmail.com> <D97140E4-9B09-4EAE-BB92-0F038FCDBA5A@gmail.com> <4EC2B656.7050902@sequans.com> <0601B8C7-9AEF-443A-A149-0F7D356345EF@gmail.com>
Date 2011-11-16 07:01 +1100
Subject Re: suppressing import errors
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2746.1321387303.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Nov 16, 2011 at 6:39 AM, David Riley <fraveydank@gmail.com> wrote:
> True, and that does avoid polluting namespace.  However, you shouldn't be testing for None as a bool; you should instead do an "if <module> is None:" (or, of course, "is not None").

Why not? Is there some other way for the module object to evaluate as false?

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: suppressing import errors Chris Angelico <rosuav@gmail.com> - 2011-11-16 07:01 +1100

csiph-web