[Python-projects] feature request: detecting when it's safe to ignore builtin overrides
Sylvain Thénault
sylvain.thenault at logilab.fr
Mon Nov 24 17:39:03 CET 2008
On Mon, Nov 24, 2008 at 09:06:28AM -0600, skip at pobox.com wrote:
> SpamBayes tries to work on versions of Python as old as 2.2. Accordingly,
> we put code in to make sure some potentially missing symbols are checked and
> set if necessary:
>
> try:
> True, False
> except NameError:
> # Maintain compatibility with Python 2.2
> True, False = 1, 0
>
> If I pylint this code using a version of Python which does support True &
> False (actually, Python 2.2 acquired those symbols sometime during the 2.2
> lifetime) it complains about overriding True and False. It would be nice if
> pylint could detect this sort of construct. 'try' something. If there is
> an 'except NameError' clause, pretend for the duration of that clause that
> any builtin symbols referenced in the try clause really don't exist (even
> though they might well exist in the version of Python being run) so that the
> statements in the except clause don't trigger complaints about the override.
http://www.logilab.org/ticket/6708
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list