r/programming • • Jun 07 '19

Win10 is going to start including Python 3.7

https://blog.adafruit.com/2019/06/04/new-guide-python-is-in-the-latest-build-of-windows-10-adafruitlearningsystem-python-adafruit-win10-windows-adafruit/
1.5k Upvotes

203 comments sorted by

763

u/Philippe23 Jun 07 '19

The title is highly misleading. In reality, "[...] every install of Windows starting with the May 2019 update will include python and python3 commands that take you directly to the Python store page."

So python's just available from the store, it's not pre-installed and ready for use on all Win10 machines....

344

u/[deleted] Jun 07 '19

Thanks God, python versioning is enough of a mess, MS preinstalling a version that will quickly become out of date would just make that worse

103

u/Philippe23 Jun 07 '19

If they installed a version by default, they would presumably keep it patched. I'd expect it to essentially be a LTS thing, but it would be stuck on whatever version (eg 3.7) "forever".

62

u/[deleted] Jun 07 '19

Like my Mac, and God help you if you install a different version without anaconda. That's when it gets confusing and buggy.

84

u/iindigo Jun 07 '19

Good news! With the release of macOS Catalina this fall, bundled Python, Ruby, etc is deprecated. No more outdated stock installs!

33

u/livrem Jun 07 '19

Just when I thought there was a chance that all the major platforms would have built-in support for the same scripting language so you could easily use that to distribute tools with.

-9

u/iindigo Jun 07 '19

I don’t think that was ever really a possibility. Linux distributions have never come with Python, Ruby, etc preinstalled and despite the headline in this story, Windows won’t either — Python will just be available on the Windows Store.

What Apple needs to do now is bundle a first party package manager with macOS so getting Python and family is as easy as it is on Linux.

69

u/livrem Jun 07 '19

What Linux distribution did not come with python pre-installed in the last many years? Quick googling says that Ubuntu has had it since "least version 8.04" (in 2008?). Raspbian certainly has both python and ruby and several other languages pre-installed by default. "Python 3 is already pre-installed on Fedora". Also some answers no stackexchange.

Even if by some definition there is some linux distribution that does not have python pre-installed, I doubt you can install many packages before you end up with python installed as a dependency anyway? I do not think I ever had to manually install python (although I have a few times had to manually install python3 when only 2 was installed or vice versa).

2

u/ericonr Jun 07 '19

I believe Python doesn't come on Arch Linux base install, but it's something that's probably added pretty fast.

55

u/thirdegree Jun 07 '19

tbf arch linux base install is the definition of absolute minimum possible linux.

→ More replies (0)

23

u/Jackalrax Jun 07 '19

I mean yeah, that's because it's arch. All distros that I've used recently that are not called arch came with python

→ More replies (0)

11

u/H3g3m0n Jun 07 '19

An Arch Linux base install doesn't include a GUI, webbrowser, sound, etc...

→ More replies (0)

3

u/ijustwantanfingname Jun 08 '19

I believe Python doesn't come on Arch Linux base install, but it's something that's probably added pretty fast.

That's not saying much. It also doesn't come with a desktop environment, network manager, etc.

24

u/cecilkorik Jun 07 '19

Almost every Linux distribution does come with Python preinstalled through. And most of them are still including 2.7 too. If you fire up a fresh unnmodified install of Ubuntu and type "python" you get a Python 2.7 interpreter. If you type "python3" you get a Python 3.x interpreter. The same is true of most other major Linux distributions that I'm aware of.

I have to imagine you're splitting hairs about the definition of "preinstalled" but I don't understand why you're assuming Windows wouldn't be able to do the same thing.

9

u/EnfantTragic Jun 07 '19

Actually, Ubuntu stopped defaulting the "python" command to 2.7 and is now 3.x (I think it started with 18.04)

5

u/-tehdevilsadvocate- Jun 08 '19

Somebody needs to tell Mint to step it up. Tessa still defaults to 2

1

u/cecilkorik Jun 08 '19

I am almost certain this is not the case. There was some fuss about Python 3, but I think that was in reference to installing the Python 3 packages by default. Python 2 is also installed by default and will continue to be for a long time yet.

If I go into a recently installed Ubuntu 18.04 server right now, this is what I get:

overlord@reddrgn:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic
overlord@reddrgn:~$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

I doubt 18.10 or 19.04 has done it either. The Ubuntu team's previously stated intention is to continue to follow PEP 394 for the foreseeable future as long as it remains active and includes the following instruction:

for the time being, all distributions should ensure that python, if installed, refers to the same target as python2, unless the user deliberately overrides this or a virtual environment is active.

As far as I know, the only distribution to ignore PEP 394's directive is Arch Linux, which is even noted in the PEP itself:

however, end users should be aware that python refers to python3 on at least Arch Linux (that change is what prompted the creation of this PEP), so python should be used in the shebang line only for scripts that are source compatible with both Python 2 and 3.

4

u/[deleted] Jun 07 '19

The good news is that Python comes with pip.

The bad news is that if MacOS doesn’t ship with Python preinstalled, then you need a package manager to install Python.

3

u/[deleted] Jun 08 '19

bash

1

u/moonsun1987 Jun 08 '19

When will the PEP to keep python and Python 3 separate on Linux get superseded?

-2

u/hungry4pie Jun 07 '19

Apple will never do that, they don’t even want you to use the shell. If they did, the terminal wouldn’t be hidden away deep in /Applications/ Utility’s

12

u/Waddamagonnadooo Jun 07 '19

You can spotlight search "terminal", just like you can windows search "cmd"/"powershell".

16

u/thirdegree Jun 07 '19

Seriously, who actually opens a file browser to open a program. Don't care what OS you use, that's just silly.

→ More replies (0)

7

u/bumblebritches57 Jun 07 '19

Using Finder to open apps instead of launchpad.

4

u/gsdatta Jun 07 '19

Using launchpad to open apps instead of spotlight

→ More replies (0)

7

u/quantum-mechanic Jun 07 '19

.... uh ok

7

u/nobodyman Jun 07 '19

It's so many clicks. First the Application folder, then there's this Utilities folder to contend with? And who's going to clean up this mess of open finder windows once I'm done??

→ More replies (0)

3

u/CommanderViral Jun 07 '19

Uh, if Apple doesn't want you using the shell, why is Catalina changing the default shell to zsh? A shell that is mainly used because it is a better interactive shell. It does nothing to add to scripting (and in fact is usually incompatible with sh or bash)

0

u/hungry4pie Jun 08 '19

Because the latest bash uses the new and shitter GPLv3 license. That still doesn't take away from the fact that Apple would probably still rather no ship OSX with it -- because in their eyes, using a terminal would be "far too complex for most users" and that they should be protected from the nasty inner workings of computer.

→ More replies (0)

2

u/segin Jun 07 '19

Utilities*

0

u/hungry4pie Jun 08 '19

You got me there. What a ridiculous typo.

→ More replies (0)

1

u/[deleted] Jun 07 '19

That's fantastic!

13

u/SuspiciousScript Jun 07 '19

Pyenv is another great solution (that can comprise Anaconda installs).

2

u/[deleted] Jun 07 '19

Pyenv is also good.

1

u/blackdragon437 Jun 09 '19

Yeah and so is Pyenv

1

u/mike10010100 Jun 08 '19

This. Pipenv and pyenv are really the best way to develop in Python.

5

u/moeris Jun 07 '19

Why does it get confusing? When you do a version install you just invite the interpreter with the version number. E.g. python3.7 instead of just python. Nothing gets broken. If you need to develop solely on that version you just use virtualenv. What are you doing that's buggy?

Are you referring to framework Python? (That is super buggy on macs)

2

u/[deleted] Jun 07 '19

I was tinkering with an open source algorithmic trading bot, everything worked great until tried to chart my data. Tried for a week to get it to chart using matplotlib. Then I had a Eureka moment and tried it on my PC. Worked the first try. My best guess after a lot of research is this:

https://matplotlib.org/3.1.0/faq/osx_framework.html

I tried using TKagg, venv instead of conda and other workarounds and nothing worked. I had the package working on my PC so I stopped trying to fix it on the Mac after a while. Hopefully the new OsX update fixes it.

1

u/moeris Jun 07 '19

Okay, yeah, it's the framework Python issue. That's not really much to do with the Python version, or even Python itself. It's MacOS specific. I've only ever run into that issue with matplotlib.

1

u/[deleted] Jun 07 '19

I was still a noob too, so... I'm pretty sure I f'd up too.

3

u/[deleted] Jun 07 '19

presumably

cries in MacOS

1

u/Prod_Is_For_Testing Jun 07 '19

And what happens when Python makes a new major version change that breaks old software?

1

u/Hypersapien Jun 08 '19

Wouldn't automatically updating it be a bad thing if the scripts you write depend on a particular version?

I don't do Python, but I use enough js libraries to know what a nightmare that would be.

1

u/Philippe23 Jun 08 '19 edited Jun 08 '19

That's what I mean by LTS (Long Term Support) and being stuck on whichever version "forever". I presume that they'd stick to a version and back port any security and stability fixes to that version without any modifications that would be detectable by users. And that they'd do that "forever" meaning the support lifetime of Win10.

Note that they haven't said they'd do this. I'm just explaining what I said above. And it's based on Microsoft's history of backwards compatiblity. Windows is basically built around backwards compatiblity. Heck you can still run programs written for Windows95 out of the box on Win10 a quarter century later. Even non-core components tend to have support lifetimes that last the lifetime of the OS release.

About updates and changes, Python does "Semantic Versioning". This site gives a good explanation of it: https://semver.org/. So some updates to Python are safe to make without worrying about needing to make changes to your existing programs.

1

u/istarian Jun 07 '19

As long as it wasn't a special Microsoft version there's no reason not to. Established programming languages mostlt don't change so often in a substantial way that it should matter.

5

u/[deleted] Jun 07 '19

Tell that to the multiple programs I have that still specifically require Python 3.5.2

4

u/istarian Jun 07 '19

You want to actually explain that, because I have really hard time believing that they don't just work fine in say 3.6 or 3.7.

I know Python's versioning is a little strange, but unless you're using some weird library...

2

u/[deleted] Jun 07 '19

PySpark does not work properly above 3.5

Edit: appears this may have been recently fixed, however the main vendor of PySpark (databricks) is still using and requires Python 3.5.2

1

u/istarian Jun 07 '19

I suppose there are always exceptions.

2

u/EnfantTragic Jun 07 '19

There was a while when Tensorflow didn't work with 3.7

1

u/Antrikshy Jun 07 '19

Possibly for this reason or others, macOS Catalina is getting rid of pre-included interpreters including Python (also Ruby?).

1

u/teerre Jun 07 '19

There are two versions of python. 2.7 and 3, which is usually 3.6, but 3.7 is fine too, in practice it's extremely unlikely something works in 3.6 and not in 3.7 or vice-versa

1

u/Retty93 Jun 08 '19

This, just this!

0

u/insanitybit Jun 08 '19

Also, attackers already have powershell and js, I really don't need them having Python on top of that.

0

u/[deleted] Jun 08 '19

[deleted]

3

u/[deleted] Jun 08 '19

Yeah, by default powershell won't let any unsigned scripts run. That said....almost anyone who actually uses powershell will almost immediately disable that.

1

u/insanitybit Jun 08 '19

Yes, Microsoft has done a great job hardening PS.

7

u/MasterDood Jun 07 '19

At least it won’t be 2.7

6

u/[deleted] Jun 07 '19

Not a windows store install package?

13

u/neoKushan Jun 07 '19

It's both. They're shipping a shim that opens up the Windows store on the Python package: https://www.microsoft.com/en-gb/p/python-37/9nj46sx7x90p?activetab=pivot:overviewtab

1

u/bduddy Jun 07 '19

The Python page on the Windows Store.

2

u/geotrackerlive Jun 08 '19

Thanks for reliable information

1

u/errorseven Jun 07 '19

Well, this is a game changer.

98

u/SuperRoach Jun 07 '19

Hey, the stock python is more up to date with windows than ubuntu now..

45

u/ProgramTheWorld Jun 07 '19

Weirdest timeline

23

u/tracernz Jun 07 '19

Ubuntu has never had latest packages. That's rolling release distros like Arch, Fedora Rawhide etc.

5

u/__gareth__ Jun 08 '19

You should never use the system distribution of Python (or Ruby), it is included to support the functioning of the OS, such as apt-get.

1

u/SuperRoach Jun 08 '19

Should it be accessible to the user at all if we should never use it then?

1

u/__gareth__ Jun 08 '19

in my opinion no, though i'm not sure that's possible

1

u/[deleted] Jun 08 '19

Why would you use the stock Python installation for development? You're just going to pollute the global package repo. Use virtualenvs instead.

4

u/lanzaio Jun 08 '19

You're missing the use case for the majority of python users - it's a scripting language. Most python users don't use it as a full programming language and they just write #!/usr/bin/env python3 scripts.

2

u/SuperRoach Jun 08 '19

Why not? for someone who wants to jump in and code right away, instead of doing that you are throwing a book at them with a bunch of barriers. That gets in the way of Pythons "one true way" ethos a bit I feel. But can see why they go for the versions they do, I just don't like the difficulty it is in onboarding new users who havn't had this conversation yet.

1

u/lanzaio Jun 08 '19

That's by design. Ubuntu isn't a rolling release distribution. It's a stability based distribution.

10

u/macca321 Jun 07 '19

They should bundle linqpad with Windows.

46

u/[deleted] Jun 07 '19

For a second there I thought that said Python 2.7! "Nooooo!"

23

u/[deleted] Jun 07 '19

It is very exciting to come to the comment section and see everyone‘s internal thought process laid out to the second.

0

u/schmerm Jun 07 '19
print 'yesssss'

14

u/[deleted] Jun 07 '19

print("yesssss")

0

u/[deleted] Jun 07 '19

[deleted]

7

u/[deleted] Jun 07 '19

cries in Autodesk

26

u/[deleted] Jun 07 '19

So Windows is going to be including Python in its store, and OS X is dropping Python entirely.

38

u/aldonius Jun 07 '19

The Mac users upthread are celebrating, because soon they won't have to worry about the outdated system installation.

-14

u/[deleted] Jun 07 '19

If they didn't want to worry about it, they didn't have to use it. The problem if for people who did use it or made applications that relied on Python 2.7 being installed.

21

u/rtbrsp Jun 07 '19

It is not nearly this simple. The stock Python installation was previously relied on by utilities such as LLDB. Even prefixing your PATH with a different installation such as /usr/local/bin/python caused issues with LLDB.

3

u/[deleted] Jun 07 '19

Lmao. I didn’t want to use it and yet I still had to worry about it. Whenever I do a clean install on my Mac I have to think “what did I do last time that didn’t leave it in a mess”.

Still causes the odd hiccup from time to time. Thank god they’re ditching default install. Just make it easy to install the latest version at that time, like windows is doing.

5

u/bumblebritches57 Jun 07 '19

That's just not how that works lmao.

-25

u/[deleted] Jun 07 '19

That's because Mac is for braindead "professionals".

12

u/EnfantTragic Jun 07 '19

Nah, developing on Mac is a way better experience than Windows, at least for someone coming from Linux programming

8

u/[deleted] Jun 08 '19

That's one of the things I envy about Mac devs. Unix command line is best command line.

Before going to college and doing way more development, I never thought that I'd be such a fan of *nix

7

u/Eurynom0s Jun 08 '19

The Linux on Windows stuff seems like it's changing that.

1

u/EnfantTragic Jun 08 '19

I wouldn't complain if it does. I don't enjoy dual boots

5

u/_EndOfTheLine Jun 08 '19

I dunno, I develop on a Mac and seeing the strides WSL has been making in such a short time has me wondering how long that will be the case.

3

u/EnfantTragic Jun 08 '19

I love WSL, so if it can match the Mac command line, then it would be amazing

7

u/look_at_the_sun Jun 07 '19

TIL I'm brain dead. Thanks, man!

1

u/Antrikshy Jun 07 '19

Well, at least it's better than Windows for development unless you develop stuff for Windows.

25

u/Science-Compliance Jun 07 '19

What I'd really like to see is Microsoft writing software that makes it easy to turn Python scripts into Windows executable files. I was pulling my freaking hair out trying to get some third-party modules to do what I wanted them to do and still don't have an application (granted, I didn't persist with that effort because it was "nice to have" but not necessary for the time being).

21

u/istarian Jun 07 '19

If you want Windows executables why not just use .NET?

1

u/tracernz Jun 07 '19

There's still no way to write a cross-platform desktop app in .NET AFAIK?

7

u/pb7280 Jun 07 '19

Xamarin has support for macOS now and I believe Linux is in beta (also WPF, UWP, Android, and iOS)

2

u/YM_Industries Jun 08 '19

Does Avalonia meet your definition?

1

u/tracernz Jun 08 '19

If/when it becomes production ready, it looks good.

1

u/YM_Industries Jun 08 '19

I think Avalonia is production-ready, I've used it in an (admittedly very simple) production app.

If you're happy to wait a bit longer, WPF Core should be good. Should hit General Availability in September.

3

u/tracernz Jun 08 '19

Says on the GitHub readme that it's only beta quality. WPF Core should indeed be good on Windows, but sadly not cross platform.

2

u/YM_Industries Jun 08 '19

Wow, I was misinformed. I thought WPF Core would be cross-platform. That's disappointing.

Looks like Avalonia is still the best option then. I just wish the documentation was better.

2

u/istarian Jun 07 '19

Depends on your definition of cross platform?

I haven't done it but there is Mono in addition to .NET under Wine. .NET wouldn't be a native application per se, regardless

4

u/tracernz Jun 07 '19

I had somewhat forgotten about Mono, and it looks like Gtk# could do it. Given that .NET Framework is dead I expect .NET Core will be getting a lot of improvement in this area soon.

1

u/1RedOne Jun 08 '19

There won't be for the foreseeable future, wpf and WinForms both depend on Windows handles, it would be a metric boatload of effort to make it happen.

Avalonia is a project trying to do just this.

1

u/pknopf Jun 08 '19

1

u/tracernz Jun 08 '19

That works, although with Qt I'd rather go first-party and write the wrapper app in C++.

0

u/[deleted] Jun 07 '19

[deleted]

9

u/istarian Jun 07 '19

???

0

u/lIlIllIlll Jun 08 '19

Developers don't use Python.

0

u/[deleted] Jun 07 '19

[deleted]

5

u/atomic1fire Jun 07 '19

Which is funnier because you can use .net with powershell to make little scripts too.

Granted Powershell core's scripts might not be as useful outside of windows, you can do some somewhat entertaining things from windows powershell just by using .net and the COM api. For instance building a GUI in Windows Forms.

In fact anything that can be accessed from COM, or .net, can be manipulated from powershell. Personally I think it's a lot of extra effort for a script, but you can do it.

1

u/[deleted] Jun 08 '19

Yeah, except that Powershell is horrendous

6

u/radol Jun 07 '19

Yeah, some time ago I though that if python is so popular, making exe for it would be as easy as for example autohotkey script. So after many bumps I managed to make .exe for small python tool (which used pandas) to quickly analyze large amount of input data, and whole app directory turned out to be like 120mb. Few weeks later I did same tool using c# (utilizing linq) and targeting .net 3.5 so nobody needs to install anything even on outdated systems, and whole app was like 500 kb

1

u/Science-Compliance Jun 07 '19

I'm going to have to look into .net at some point. I did get a couple simple command line applications to work with pyinstaller, but the application in question had a tkinter GUI that wouldn't render with 3 separate tools I used (pyinstaller, py2exe, and cx_Freeze). cx_Freeze wouldn't even pip install with Python 3.7, and I had to downgrade to Python 3.6 to get it to install (still didn't work, though). I, too, expected it to be a piece of cake given Python's popularity.

3

u/ArkyBeagle Jun 08 '19

This is a critical reason I still use Tcl.

3

u/schlenk Jun 08 '19

tclkit is great for that, but Python actually copied a lot of the features in pyinstaller (still no vfs support, and much bigger runtime), but it usually works.

2

u/George_Rockwell Jun 08 '19

py2exe has worked well for me

1

u/Science-Compliance Jun 08 '19

What version of Python are you running?

2

u/George_Rockwell Jun 08 '19

At the time of me using py2exe, it was python 2.7. might be out of date now, but it worked well at the time for what I needed to get done.

2

u/Science-Compliance Jun 08 '19

Yeah, I don't think it works very well if at all with Python 3, which is what I'm using (3.7). Unfortunately, the differences between 2 and 3 are big enough where a downgrade is not really feasible.

4

u/PopTonArch Jun 08 '19

pyinstaller has worked really well for Python 3 for my product.

36

u/tracernz Jun 07 '19

This is great news. One more nail in the Python 2 coffin, and one less hoop to guide Windows users through.

7

u/upofadown Jun 07 '19

I suppose that any language made easily available other than Py2 is a nail in that particular coffin.

6

u/imhotap Jun 07 '19

Could someone knowledgable in the Windows world tell me if WSL (Win subsystem for Linux for running Ubuntu programs) is now installable on any Windows machine, or still just works with Win Pro? There seems to be a Creators Update or so, but I can't figure it out. Asking for a friend who wants to release a nodejs app (mostly for Linux and Mac, but would be helpful to know if it could run on Win without Docker so people don't get a bad experience).

13

u/unkz Jun 07 '19

Yeah, you can do it in Home edition.

3

u/EnfantTragic Jun 07 '19 edited Jun 08 '19

You can do it on the Home edition. What you will miss from the Pro edition is Hyper-V, which is an inbuilt way to run virtual machines. Docker for Windows relies on it, but you can do without using Oracle VM and Kitematic

5

u/MaxGhost Jun 08 '19

But with WSL2 you'll be able to run docker! Coming soon.

2

u/Herm_af Jun 08 '19

So excited. Docker, manipulating Linux files from Windows, and much much faster. That and terminal are going to be awesome. I was dual booting but that in itself is a pain. I did like developing in Linux though. This is huge

1

u/EnfantTragic Jun 08 '19

That would save me a lot of headaches!

3

u/nsomnac Jun 08 '19

This may have changed since Windows 10, however HP had ActiveState Python installed on every consumer computer they sold since Windows XP. It wasn’t linked to the Path, but it was there to support their system recovery.

Source: I designed and implemented an early CI/CD system for building and testing their OEM PC disk images.

2

u/iMalinowski Jun 09 '19

"A surprise to be sure, but a welcome one."

5

u/StatusDecline Jun 07 '19

Could someone ELI5 the relationship between an OS and a programming language? OSes are written in a language (Ex: iOS in Objective-C), so what does it mean to include a language in an OS? Does the OS have a translator into the native language before the compiler?

36

u/killerstorm Jun 07 '19

so what does it mean to include a language in an OS?

From operating system's point of view Python is simply a program like anything else. So it just includes one more program (or allows you to install it easily).

17

u/Objective_Mine Jun 07 '19

I don't know how much of an ELI5 you want, but...

Python is generally an interpreted language rather than being compiled into native code (such as the OS itself would have been), so in order to run programs written in Python, you need to have a Python interpreter. In addition to the interpreter, the Python platform is considered to consist of the Python standard library that includes common functionality that can be expected to be available to programs written in Python, and possibly some other tools.

Including Python in the OS would mean including those components, which would allow you to run programs written in Python, and to write your own. You could do that anyway by downloading and installing the Python platform for Windows but after it's included with the OS, you can run and develop Python programs without having to do that.

The Python interpreter is a program that executes Python code on the go. It's not a translator to another programming language such as C which would then be compiled to native code. (Native code means executable code that can run directly on the computer hardware. A programming language used for the OS itself, e.g. C, could be considered "native" to the operating system in some sense but it's not called native code. The C code compiled into executable form would be called native code.)

Other languages such as C, C++ and Objective-C are compiled languages. Code written e.g. in C would be compiled into native code that can then be run directly on the hardware. "Including" a language like that in an OS would probably mean including a compiler needed for developing new programs.

A compiler would not be needed for running a program written in C, such as the operating system itself, because it has already been compiled when it ships. Thus, an operating system written in C may or may not ship with a C compiler. You might still need to have the corresponding standard library available even at runtime, though.

4

u/iLumion Jun 07 '19

Correct me if I’m wrong but don’t interpreted languages get translated on the go? For example python compiles very quickly to .pyc and that file is interpreted which translates itself to machine code on the go?

4

u/Feynt Jun 07 '19

Yes, Python compiles your source seamlessly to .pyc files when you attempt to run your program, so the initial run of the program is slightly slower to get going (very, very slightly). The .pyc files are bytecode which is very easy to interpret in comparison to monkey pawed variable, function, and class names in plain English. This compile step happens any time the associated .py file is changed. For most libraries, that's never, but any program you're actively working on will have its source files recompiled with each change.

4

u/TheSkiGeek Jun 07 '19

Depends on the details of the interpreter.

Java, for example, is "compiled" to JVM bytecode, which is then "interpreted" in some way (possibly JIT compilation to native code).

If you go far enough down, even "machine code" is "interpreted" in some cases. Both Intel and AMD slice x86 instructions up into "micro-ops" that get potentially reordered and scheduled onto hyperthreads, and do stuff like register renaming on the fly.

1

u/Objective_Mine Jun 08 '19

Yeah, thanks for the additions. I didn't know how to keep it ELI5, and, to be honest, I wasn't quite sure if Python actually gets JIT compiled (maybe on Jython?), so I stuck to the basic cases.

5

u/Thiras Jun 07 '19

There is no relationship apart from the fact that an OS is written in a (compiled) programming language.

Programming languages are split into two VERY broad categories, compiled and interpreted. Compiled languages go through a compiler to transform source code (the text) into a program (1's and 0's) that are run by your computer directly. Interpreted languages are run by an interpreter (itself a compiled program), which reads lines of text from the code and performs the operations specified by the code.

Python is the second category, and this story relates to the interpreter for python, not any particular python code.

7

u/wlllb Jun 07 '19

I would say, rather, that a compiler takes the source code and simply maps it to a lower level representation which could be, but is not exclusive to, machine code. javac is a compiler that outputs JVM bytecode for example, and then you could also argue that the JVM itself is an interpreter operating off that bytecode

3

u/[deleted] Jun 07 '19

By including it they just mean the Python interpreter would be installed as default, the way it had been on OS X for years. It doesn't really have anything to do with the OS itself;

HOWEVER, there is a caveat. If an OS is including the Python interpreter by default, then developers can assume that it is installed on a system running that OS and make programs and applications that assume that as well. So you could make use of the interpreter. OS X removing Python may very well break legacy applications that rely on Python.

0

u/billsil Jun 07 '19

By including it they just mean the Python interpreter would be installed as default,

No it won't. It will be available in the Windows Store for free. It will not be maintained by Microsoft and instead the PSF.

the way it had been on OS X for years

Not as of the next version.

3

u/[deleted] Jun 07 '19

No it won't. It will be available in the Windows Store for free. It will not be maintained by Microsoft and instead the PSF.

Yes, I know, hence would be and they mean.

Not as of the next version.

had been

2

u/Ilmanfordinner Jun 07 '19

Imagine you want to write your own operating system for your computer. You have a few options on how to do so:

  • You take out the hard drive, attach it to a machine that can write bytes to it one by one. The issue is how do you decide what bytes to write? Well, there's this manual that the people who designed the hardware made that tells which bits correspond to which commands on the computer. So you go through the difficult process of breaking down your operating system into very simple commands that the computer can understand directly and then write the entire thing to the hard drive. People did this when computers were simpler and the alternative process did not exist. This is called coding in Assembly.

  • You already have a working computer so you think for a moment "Hmmmm, I'm going to be reading from the hard drive a lot of times. The Assembly code for reading a file on my machine is very long and writing it by hand would suck. How about instead I make a program that substitutes something like mem[addr] = file.read(filename) for that long bit of Assembly that reads a file and stores it in the memory at address." Great, but what if you do the same for other useful things? What if you do it for everything? Well, eventually you're going to have so many of these "commands" that you've made up and given meaning to that it kinda resembles a language. So the main thing that differentiates between the languages is what "commands" they have and how broad they are.

In any case, what you need to remember here is that OSes are either written manually using Assembly or using a programming language on another computer such that that computer can understand it. In other words that language is installed on the computer. Hence, this discussion on bundling Python with Windows.

(Note: this is super simplified)

1

u/iLumion Jun 07 '19

In short and very very simplistic and basic:

All programming languages compile down to machine code in some way. The machine can read the code and act on it. So basically every OS should be able to process every language given they have the supporting tools.

To take iOS as an example: iOS has been mostly written in C or C++. The apps however can be written in objective C, swift or C. But, there are some frameworks which allow you to write code in an entirely different language (Xamarin for example) which compiles down to native machine code so iOS can understand it. Even though Xamarin uses C#, a Microsoft language.

Keep in mind that this is very basic. Don’t take this to seriously. If you want to know more this should at least give you a simple base to research further upon. As not all languages are compiled etc.

1

u/bumblebritches57 Jun 07 '19

No, C, C++, and Objective-C are al compiled into machine code.

there is no intrepreter nessicary, in fact MacOS and Windows don't even include compilers out of the box.

1

u/Feynt Jun 07 '19

An operating system (OS) is a program itself which has been made to control access to the various components of the system it's installed on. RAM partitioning, disk fragmentation, video card access, everything. It's partly security (no accessing RAM some other program has assigned to it, so no reading someone's password for example), and party sanity (no you can't open the serial port, someone else is using it. One at a time, no touching!). As with all things man made, there exists loopholes and oversights for all the puzzles here (which is why viruses can do both of those things) using exploits that some otherwise brilliant person didn't realise would be a thing. Obviously, the above is a gross simplification, but moving on...

Programming languages in general have little direct relation to an OS in particular. C++ works the same on macOS, Windows, Linux, FreeBSD, DOS, and so on. At least at a basic level (variables, for loops, etc.). Where things get dicey is if you want to execute the program, you need to compile it to match the operating system it's being run on (C++, Assembly, etc.) or have an interpreter to run the code you typed (Java, Python, etc.).

Firstly compiling, you would need a collection of the special rules and interfaces that the OS is providing to interact with all of the system (the libraries). The compiler turns all of your plain text words into a collection of bytes which mean something to the computer when the OS begins execution. Your compiled program has an OS agreed upon start location, and when loaded into memory and run through, will perform certain actions on the hardware to achieve a result.

Interpreted languages (like Python in this case) ditch the need to compile your code against a set of OS specific libraries by compiling the code to more portable formats (most commonly a bytecode format, which is supposedly a step or two removed from actual machine code). Instead, the interpreter itself needs to be compiled to run against these libraries. This has the advantage that you can write code once and then reuse that code across multiple computers regardless of the OS (as long as an interpreter exists). So code you write on Windows will in theory work on Linux or macOS just the same.

Either way, when a program runs on an OS, it's interfacing with it instead of directly with the hardware itself. Actually writing an OS requires super low level programming (done in compiled languages, often Assembly). Often a means of writing this program is necessary and accomplished from an outside source. But an OS is just a fancy program that lets other programs interact with it. The before times of the Apple IIc or even the Vic20 basically had you sitting at the most basic of OSes, ones which basically only made it possible to write programs that had this bare access to the computer without needing more basic tools such as magnetic tape writers.


The reason this whole Python thing is such a big deal is because many developers work across a few different operating systems, and doing Python programming on one to affect all of them makes life a lot simpler. Instead of having to recompile your program on each OS, as you would with say, Photoshop or Word, you can write it once (Microsoft hopes dearly that you choose its expensive OS instead of macOS or Linux) and then distribute to the others straight away.

1

u/khoyo Jun 07 '19

They are not talking about including the language* in the Windows kernel, just bundling it like they do for eg. Word, Excel, Internet Explorer, etc, in the general product.

* And by the language, we mean the compiler/interpreter.

-4

u/inarush0 Jun 07 '19

This just means windows 10 will come with python 3.7 installed, so you don’t have to install it from python.org

24

u/xerios Jun 07 '19

That's not what it says. It says that typing "python" or "python3" in command line will open up the microsoft store window to install it.

I'm on the latest insider build and that's pretty much what it does. Having it pre-installed would've been nicer but this is fine nevertheless.

2

u/billsil Jun 07 '19

I disagree that it would be nicer. That would mess up my install of Python. I'm a big kid; I can manage it myself.

-1

u/AngularBeginner Jun 07 '19

Awesome... More trash in the PATH variable.

1

u/stewsters Jun 07 '19

Yeah, that doesn't sound incredibly useful if its only python. Might just want to update the message that it gives you if the command is not found. In Ubuntu, if I type a command that doesnt exist it will suggest similar commands from the repo, not perfect but a lot more general.

~$ pdthon

Command 'pdthon' not found, did you mean:

  command 'python' from deb python3
  command 'python' from deb python
  command 'python' from deb python-minimal

Try: sudo apt install <deb name>

1

u/[deleted] Jun 07 '19

Who doesn't love a PATH configurations?? That's clearly the future! /s

-15

u/[deleted] Jun 07 '19

[removed] — view removed comment

-18

u/Anti-The-Worst-Bot Jun 07 '19

You really are the worst bot.

As user MoSqueezin once said:

BAd bot

I'm a human being too, And this action was performed manually. /s

1

u/ovrdrv3 Jun 07 '19

Has anyone installed WSL on win 10 similar to this article?

https://itsfoss.com/install-bash-on-windows/

How was the experience? Thanks

2

u/Herm_af Jun 08 '19

It's pretty slow for npm install and such and you can't run docker (easily )

Also just adds little quirks that are annoying.

However when wsl 2.0 comes out ill use it for everything.

1

u/ovrdrv3 Jun 08 '19

Thanks for the feedback, any date yet on WSL 2.0?

1

u/Tarbogman Jun 07 '19

Haven't read all the comments here, but still I wonder how well pygame will cooperate with this?

1

u/[deleted] Jun 08 '19

What's with Ruby?

1

u/tamalm Jun 08 '19

When are they planning to include kernel 5.0? ;)

1

u/Comrade_Comski Jun 08 '19

Call me when Win10 supports nix

-8

u/AwesomeBantha Jun 07 '19

I see this as an absolute win!

3

u/monkey-go-code Jun 07 '19

When is this meme going to die

0

u/twisted-teaspoon Jun 07 '19

Presumably that is impossible because as soon as it does, some meme-using pleb will use it to celebrate its death.

-6

u/KevinCarbonara Jun 07 '19

Python 2 fans are in tears

-26

u/lambda-panda Jun 07 '19

Does the world need Microsoft anymore?

22

u/KevinCarbonara Jun 07 '19

For the past decade they've been far outpacing their competitors. C# makes me wonder if the world needs Java anymore

13

u/topcat5665 Jun 07 '19

And in the past few years I feel they've become a much better company with the open source stuff they are doing, e.g .net core and the like.

-1

u/lambda-panda Jun 08 '19

I feel they've become a much better company with the open source stuff they are doing

That is only because they feel like they are loosing relevance. It is an act. The first phase of EEE. I am surprised that people still falling for it...

1

u/tuldok89 Jun 09 '19

How does one EEE their own stuff?!

1

u/lambda-panda Jun 10 '19

Which "their own stuff"?

7

u/[deleted] Jun 07 '19

Java devs finally got var like last year or something lol

I've done some small personal andriod apps in Java and my god. Doing basic shit in C#/.NET that takes like 3 lines is like an entire fuckin class in Java with 40+lines.

5

u/KevinCarbonara Jun 07 '19

Java still has no auto properties. We have to choose between either writing our get/set functions manually (or letting the IDE generate them automatically), clogging up our code, or we can rely on a third party plugin called Lombok to generate them automagically, leaving our classes clean, but the rest of our code cluttered with references to getId() functions that, by all appearances, don't exist.

Of course, the big one is Linq. Java got Streams, but it is nowhere near as elegant as Linq. Which is surprising, because they had a great example to learn from. I think Java developers legitimately want their development to be lengthy and over-verbose, maybe it gives them job security.

5

u/[deleted] Jun 07 '19

plus Visual Studio just is an amazing IDE with no real competitor IMO.

Either you choose Eclipse or IntelliJ IDEA... and both are laggy shits. Maybe its changed, but that was my experience years ago.

3

u/Answermancer Jun 07 '19

IntelliJ is actually pretty great these days, but hilariously I think it's biggest downside is that it's written in and runs on Java.

-1

u/bumblebritches57 Jun 07 '19

... Does the world need python at all?

-4

u/a32m50 Jun 07 '19

So they are creating their own repo. If you can't beat it, copy it