Yarco
Yarco

Reputation: 803

Why java is also a system/OS name(help doc in python)?

I'm searching a method in python to show me the platform details. So I find platform.system(), but I got shock when I saw the help doc:

system()

Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

Any idea on why 'Java' is listed there but not 'Darwin'?

Upvotes: 6

Views: 1240

Answers (1)

Anomitra
Anomitra

Reputation: 1161

Darwin is indeed one of the possible outputs of the platform.system() method. I did a quick Google search and came up with this.

import platform

print 'uname:', platform.uname()
print 'system   :', platform.system()
print 'version  :', platform.version()

Java is probably there for Jython implementations, as someone pointed out above.

EDIT: Further Googling led me to this:

Jython proof

platform.system() uses sys.platform, so I think this is where the Java comes from. This excerpt is from the book Jython Essentials: Rapid Scripting in Java and therefore can be regarded as conclusive. Link included for reference.

Upvotes: 3

Related Questions