Community
    • Login

    Updated Autocomplete for Python 3

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 5.3k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Noah BlackN Offline
      Noah Black
      last edited by

      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?

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • EkopalypseE Offline
        Ekopalypse
        last edited by

        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)

        1 Reply Last reply Reply Quote 1
        • PeterJonesP Online
          PeterJones
          last edited by

          @Ekopalypse gave a good starting place. If you’d like more details, see the Notepad++ UserManaual, especially:

          • auto-completion
          • langs.xml details
          • themes.xml details and the themes overview
          1 Reply Last reply Reply Quote 1
          • Alan KilbornA Offline
            Alan Kilborn @Noah Black
            last edited by

            @Noah-Black

            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”

            1 Reply Last reply Reply Quote 1

            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors