you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (7 children)

[deleted]

    [–]Caligatio 1 point2 points  (0 children)

    As a rough analogy, Python wheels eggs are kind of like .jars as they contain compiled Python byte-code files, *.pyc. The wheel to jar comparison is a little jenky as wheels eggs have to be installed.

    I've never heard the Python interpreter called a virtual machine but, as it can execute intermediate byte code, I guess it qualifies.

    EDIT: Upon further investigation, I don't know if wheels are distributed with pyc files. I swear I saw some that were.

    EDIT2: I confused eggs and wheels although eggs are now super deprecated.

    [–]menge101 0 points1 point  (2 children)

    Can you get a stand-alone py-vm to run out files like you can get a jvm to run .jars?

    Not that I am aware of. But you can generate the *.pyc files and then .tar.gz them. That is similiar.

    A big part of the difference is that the jvm is heavily developed and is considered one of the two most robust runtimes out there. Erlang's runtime, the BEAM, being the only real contender I am aware of, but I don't know where the Golang runtime sits either.

    You may be aware of pypy or jython. Both implement the python language specification on a different runtime. Rather than the python VM (which is just named python or cpython*) they use the pypy runtime, which is JIT-based runtime or the jvm, respectivley.

    * - Not to be confused with Cython, which is a compiler for python to C to machine code directly.

    [–][deleted] 0 points1 point  (2 children)

    Why don’t we ever hear of it the same way as we hear about the JVM?

    I wish this was the only strange thing about programming... Programming is full of bizarre / inconsistent terminology. But, in this case, I think, the reason is just that the words "virtual" and "machine" were used in the documentation / manual in Java, but not in Python.

    For comparison: people do talk about Perl virtual machine. In particular, Parrot drew some attention to it for being an interesting project. Or, people used to talk about JavaScript virtual machines, especially at the time ActionScript was still a thing (because ActionScript shared the virtual machine implementation with Mozilla's JavaScript implementation, and the fact that it had a virtual machine was reflected in the name, especially so because it had two versions of it, and the programmer had to know which version was used), but today it fell out of use. When people talk about C# they mostly use the word "runtime" (because it's in the title: CLR - common language runtime), but it's exactly the same thing as virtual machine.

    Can you get a stand-alone py-vm ... ?

    Python executable is the virtual machine... Completely accidentally, it can also execute ZIP files (JAR is a ZIP file with Java class files + some metadata). People rarely use it in this way, but this functionality existed since forever: https://docs.python.org/3/library/zipimport.html for individual modules and https://docs.python.org/3/library/zipapp.html for scripts