checker of using python2

75 views
Skip to first unread message

MURAOKA Taro

unread,
Jan 14, 2017, 10:08:55 PM1/14/17
to vim_dev, Bram Moolenaar
Hi the list and Bram.

I suggest to add checker of using Python 2.x

Python 2 will be retire 2020, and it is not so far.
https://pythonclock.org/
To stop using Python 2.x suddenly is not easy for Vim users.
Because it is difficult to know which scripts are using Python 2.
So vim may help to detect it.

I have wrote a patch for proof of the concept.
Please check it:
https://gist.github.com/koron/90f6b56b73c211e059a3b8ab1db335a9

My patch do three things:

1. Show a waring message at only once when Python 2.x is used.
2. The warning could be suppressed by 'nopy2warn' option.
3. :py2usingfrom shows list of files which use Python 2.x

Names for command and option which I added are not good, I think.
Please replace those by better names.

Best.
--
MURAOKA Taro <koron....@gmail.com>

Bram Moolenaar

unread,
Jan 15, 2017, 7:54:15 AM1/15/17
to MURAOKA Taro, vim_dev, Bram Moolenaar
Can be useful, if the user cares about avoiding Python 2.
But it should not warn by default.

It should be possible to add a flag in scriptitem_T. And the line
number would be useful too. The sourcing_lnum has the value.

--
MAN: You don't frighten us, English pig-dog! Go and boil your bottoms,
son of a silly person. I blow my nose on you, so-called Arthur-king,
you and your silly English K...kaniggets.
He puts hands to his ears and blows a raspberry.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

MURAOKA Taro

unread,
Jan 15, 2017, 9:47:32 AM1/15/17
to Bram Moolenaar, vim_dev
Thank you for comments.
I'll try to improve ;)
--
MURAOKA Taro <koron....@gmail.com>
Reply all
Reply to author
Forward
0 new messages