Search code examples
pythonwindows32bit-64bit

Where does "win32" come from when I'm using windows 64bit


I'm using windows10 64-bit, I downloaded Python 3.8.1 for windows x86-64. But when I type "python" in cmd, the output says "win32". Where does that come from? Or is that normal?

C:\>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

New in Python, please could anyone help?


Solution

  • tl;dr: "Win32" is still the common name of the Windows API, regardless of whether you're using it on a 32-bit or 64-bit machine.

    Background

    The Windows API was once called WinAPI, and the earliest versions ran on 16-bit computers.

    When they started to make versions for 32-bit computers, they had to modify a bunch of the API's functions and how some parameters were passed in window messages. This was largely due to Win16 having used some tricks to save memory.

    But the names of these functions and messages were mostly unchanged, so it was often necessary to distinguish between the 16- and 32-bit versions when, for example, you're trying to figure out what information the WPARAM of a window message is carrying. The term "WinAPI" gave way to "Win16" and "Win32", and eventually Win16 was left behind.

    When Windows built versions for 64-bit computers, the API did not have to undergo the same kinds of changes (at the source level). So there was no need to change the term.

    Python's version line simply means that this version is made to run on Windows.