pylint #6708 detecting when it's safe to ignore builtin overrides [open]
skip 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. | |
priority | normal |
---|---|
type | enhancement |
done in | <not specified> |
load | 0.500 |
load left | 0.500 |
closed by | <not specified> |
- pylint #4593 pylint complains when initializing attribute via property()
- logilab-astng #8766 support for namedtuple
- logilab-astng #905 proper metaclass support
- pylint #9223 __future__ module does not contain real symbols
- logilab-astng #2477 false positive on class derivating from base types