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


Groups > comp.lang.python > #44796

Re: How to avoid PEP8 'imported but unused'

Date 2013-05-06 11:47 +0900
From Adam Jiang <jiang.adam@gmail.com>
Subject Re: How to avoid PEP8 'imported but unused'
References <20130505160054.GA10521@capricorn> <CAA=1kxT6M_wn7Ek+RAN9Zo1KJ7T4sMdDgDd4LC1CqaRJkToNqQ@mail.gmail.com> <20130505164030.GA12637@capricorn> <CAA=1kxRS5P0UZnsUeFwq_W397sj-oB6oX-oOj5Fzy9HDse3=UA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1315.1367808493.3114.python-list@python.org> (permalink)

Show all headers | View raw


Thank you. Problem solved.

/Adam
On Sun, May 05, 2013 at 06:27:44PM +0100, Fábio Santos wrote:
> 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


Thread

Re: How to avoid PEP8 'imported but unused' Adam Jiang <jiang.adam@gmail.com> - 2013-05-06 11:47 +0900

csiph-web