Pylint across Python versions
ned at nedbatchelder.com
Mon Feb 10 16:36:50 CET 2014
On 2/10/14 6:39 AM, thomas.lehmann at adtech.com wrote:
> somebody who can tell me about pylint experiences across
> different Python version.
> I'm using a construct like this:
> if sys.version.startswith("3."):
> unicode = str
> The reason is that Python 3 does not have this
> function anymore but pylint yells for Python < 3
> about redefinition also it does not happen.
> How to get forward with this?
Pylint may have a difficult time understanding what you are doing here.
You can use pylint comments to tell it to shut up when you know better.
But also, you might find it easier to use the "six" module from PyPI to
handle these sorts of differences. It's easier than doing it ad-hoc
with your own logic.
Ned Batchelder, http://nedbatchelder.com
More information about the Python-list