Updated Autocomplete for Python 3
-
I’ve been using NPP as my Python editor ever since I started learning it. I first learned Python 2.7, and NPP has support for Python 2.7’s syntax, and hints on what functions do when I typing them (like telling me what parameters I need). This was all very helpful when learning, and is something I still appreciate.
However, I have recently updated to Python 3.7, and there are some changes between these versions. NPP still gives me suggestions as though I’m using Python 2.7, even though I don’t even have it installed on my computer anymore.
This is best seen when getting user input. In Python 2.7, input() was a function that would only accept and return integers as input, and raw_input() was a function that would accept any input because it would be returned as a string.
In Python 3.7, there is no such function as raw_input(). It was removed, and now input() uses strings instead of integers.
However, NPP still tells me that input() returns an integer (in a round-a-bout sort of way) and that a function called raw_input() exists and returns a string.How do I make NPP give suggestions for Python 3 instead of Python 2?
-
The autoComplete files are available within autoCompletion directory.
The file you are looking for is called python.xml.
In addition you might add/change the langs.xml file, or in case you use a theme different to default theme the THEME_NAME.xml from theme directory, in order to get the new keywords.
Note, adding keywords can also be done by using the gui
Settings->Style Configurator->Language(Python)->Style(KEYWORDS) -
@Ekopalypse gave a good starting place. If you’d like more details, see the Notepad++ UserManaual, especially:
-
There was also a recent issue filed regarding this: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6259 “Fix keywords list according to Python 3”
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login