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


Groups > comp.lang.python > #44758 > unrolled thread

Re: How to avoid PEP8 'imported but unused'

Started byFábio Santos <fabiosantosart@gmail.com>
First post2013-05-05 18:27 +0100
Last post2013-05-05 18:27 +0100
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.


Contents

  Re: How to avoid PEP8 'imported but unused' Fábio Santos <fabiosantosart@gmail.com> - 2013-05-05 18:27 +0100

#44758 — Re: How to avoid PEP8 'imported but unused'

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-05-05 18:27 +0100
SubjectRe: How to avoid PEP8 'imported but unused'
Message-ID<mailman.1302.1367775216.3114.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web