pylint or similar to test version-specific language constructs?

thenault at gmail.com thenault at gmail.com
Fri Jan 11 03:35:39 EST 2013


On Thursday, January 10, 2013 12:45:32 AM UTC+1, jkn wrote:
> Hi all
> 
>     I have to write python code which must run on an old version of
> 
> python (v2.4) as well as a newer (v2.7). I am using pylint and would
> 
> like to check if is possible to check with pylint the use of operators
> 
> etc. which are not present in 2.4; the ternary operator springs to
> 
> mind.
> 
> 
> 
> I haven't found anything in pylint which indicates it can do this sort
> 
> of check; am I missing anything? Other suggestions for this kind of
> 
> checking welcome.


Hi,

there is no such checker in pylint yet, though it should be fairly easy to build one. The longer part being to identify all constructs that should be detected and their representation in the ast. Then pylint checkers are simple visitors. You'll get some help from the project mailing list (python-projects at lists.logilab.org) if you go that way.

Regards,

-- 
Sylvain



More information about the Python-list mailing list