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


Groups > comp.lang.python > #65826

Re: Pylint across Python versions

From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: Pylint across Python versions
Date 2014-02-10 10:36 -0500
References <317fd2a4-186b-4b97-ad7f-084609d0a9a4@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.6629.1392046619.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2/10/14 6:39 AM, thomas.lehmann@adtech.com wrote:
> Hi,
>
> somebody who can tell me about pylint experiences across
> different Python version.
>
> Example:
> 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?
>
> Regards,
> Thomas
>

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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Pylint across Python versions thomas.lehmann@adtech.com - 2014-02-10 03:39 -0800
  Re: Pylint across Python versions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-10 13:03 +0000
  Re: Pylint across Python versions Chris Angelico <rosuav@gmail.com> - 2014-02-11 00:59 +1100
  Re: Pylint across Python versions Ned Batchelder <ned@nedbatchelder.com> - 2014-02-10 10:36 -0500

csiph-web