Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44758
| References | <20130505160054.GA10521@capricorn> <CAA=1kxT6M_wn7Ek+RAN9Zo1KJ7T4sMdDgDd4LC1CqaRJkToNqQ@mail.gmail.com> <20130505164030.GA12637@capricorn> |
|---|---|
| Date | 2013-05-05 18:27 +0100 |
| Subject | Re: How to avoid PEP8 'imported but unused' |
| From | Fábio Santos <fabiosantosart@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1302.1367775216.3114.python-list@python.org> (permalink) |
That assert will never fail. If the symbol is not imported, the import statement raises ImportError. And actually "assert" makes sure that the value is not false-ish, not None/Null. And AFAIK a module object is *always* true. > One more question. In this particular case it seems 'assert' should be > safe as a workaround, doesn't it? 'assert' will check if the symbol > is imported and not NULL. Is there side effect if I just applied this > rule as a generic one. > -- Fábio Santos
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to avoid PEP8 'imported but unused' Fábio Santos <fabiosantosart@gmail.com> - 2013-05-05 18:27 +0100
csiph-web