Python work arrangements

  • It's been a while since Python used for his purposes. The question arose from the implementation of the language itself. Start with ambiguities on the order:

    1. Python's tongue, as far as I understand, was written on C. But then what? So Cython? Is that the same?
    2. If it's written on C, how does it interpret? I have the assumption that each line is compiled separately and It's starting immediately, isn't it? Can I read it somewhere? Sources?
    3. There's information on Python's virtual car on the Internet. What is this? What? I know Java has one. But Java is not interpreted Language. After compiling, there's a white code that then JRE. interprets it under a specific car. But there's no such thing. JRE... Or eat?

  • Strictly speaking, there are several interpreters of the language of python written in different programming languages.

    This is the implementation of an interpreter on the C - CPython (si payton).

    There is also a Java interpreter (Jython), on Net (IronPython) and even on the python itself (PyPy).

    In most cases, it is a benchmark implementation.

    Don't CPython and Cython are different things. First is an interpreter, second is an addition to language. Since CPython is written on C, it can use C-specific structures. That's what the Cython project is doing. In the python code, you can declare a structure from C and then work with it. I mean, it's very rare to use very specific projects.

    Programmes on python are transferred to the White Code when the program is launched. In doing so, files are being created with an expansion of the pyc - compiled. They can be launched without the original pyre of the file (and even transferred back to the pyre if they weren't defused). Previously, the files were also created... ..iro-objective files, but they are no longer being created from 3. Also in python3 they changed their location - now they're placed in the sub-division of __pycache___.

    You can find the origins of the python. (They still have a read-only mirror on )


    Let's take a closer look at the python compared to java.

    Java has an interpreter and a virtual machine, and Python has a virtual machine like an interpreter. The reason that the Virtual Car is closer to Java, and the Interpretator is closer to Python is that there is a large difference between these two languages: the static pattern in Java against the dynamic typicalization in Python. Here, speaking of types, I will keep in mind the data structures stored in memory, with which this programming language works.

    The Java Virtual machine is simple - it requires the software to declare the type of each variable in the code. This provides a sufficient amount of information to enable the Bait Code Java to be interpreted not only by the virtual Java machine, but also compiled in (assembler code).

    Python's Virtual Car is much more difficult to take on additional suspension tasks for each operation to determine the type of data for each variable or data structure included in each operation. Python frees the programmer from thinking at the level of basic data types * and allows it to focus on a higher level of abstraction. The price of such freedom is productivity. The Interpretator is a priority term for Python as it stops to define the data caps and because a short synthesis of dynamic programming languages is better suited to interactive interfaces. There are no technical barriers to making an interactive Java interface, but the attempt on-line set of statistical code (which means a console interpreter) will be exhausting, so no one does.

    Java's world is silent on the whole interactiveity because it launches programmes in a language that can be compromised in the machine code at all and will therefore have a high speed and efficient flow of resources. The Bait Code Java can be implemented by a virtual Java machine with a productivity comparable to those compiled into a machine code. Java's Virtual machine puts Java in its own category:

    Transmitted interpretable statically typified language

    The closest is LLVM, but LLVM operates at another level:

    translated assembler language

    The term "byte-code" is used not only in Java and Python, but not all the white code is created the same. Byte code is only a common term for intermediate languages used by compilators. Even a compiler of C, for example gcc, uses for your needs. Byte-code Java contains information on basic data types, whereas Python White-code is not. In this sense, Python's virtual machine (and Bash, Perl, Ruby, etc.) is actually much slower than Java's virtual machine, or even if it's easier, she's got more work. It should be noted that the information contained in the different White Codes is different from that presented:

    • LLVM: registers cpu
    • Java: basic data types
    • Python: User data types

    Analogy from the real world can be imagined that LLVM works at the atomic level, Java is molecular, and Python works with the mother. Since everything can be broken into subatomic particles (machine surgery), the hardest job at Python's virtual machine.

    Tractors/compilers of static languages do not have the same ties as dynamic interpreters/compilers. Statistic language programmers have to sacrifice something for productivity. However, just as all non-determinized functions are in fact determinated and all dynamically typified languages are in fact staticized. The differences between these classes of languages should be bridged over time and Python could be renamed

    Virtual machines of dynamic languages, such as Python, carry a more idealized logic car and should not be carefully linked to actual physical equipment. The Java Virtual Car is more similar to the classical compiler C, in addition to the implementation of the engine code, the built-in subprogrammes. In Python, a whole number of integer is an object with a bunch of attributes and methods associated with it. In Java integer, it's a bat sequence, usually 32nd. It's not the most honest comparison. The entire Python numbers should be compared to the integer class in Java. The type of data int in Java can't be compared to anything in Python because Python simply excludes this level of abstraction, just like his white code**

    Since all the variables in Java are staticly typified, it is reasonable to state that an interpreter like Jython will be faster than an interpreter CPython. On the other hand, the Java Virtual Car on Python is almost guaranteed to be slower. And don't expect Ruby, Perl, etc. to be better. They weren't meant for this. They were designed for Scripting, something called dynamic programming.

    Every operation in a virtual car necessarily affects real equipment. Virtual machines contain pre-defined subprogrammes that are generally sufficient to perform any sequence of logical operations. The virtual machine may not specify new machines, but accurately implements its internal subprogrammes and various complex subprogramme chains. The Java Virtual Car, as well as the Python Virtual and all other general-purpose virtual machines, are identical in the sense that you can programme them to perform any logical sequence, but different in what tasks they take, and which are left to the conscience of the programmer.

    The morale of this story is that the information on basic data types actually helps the compiler/virtual car.

    Finally, in order to be completely confused, imagine: the Python programme is carried out by an interpreter/virtual machine on Python, which is carried out on an interpreter/virtual Java, which is performed on LLVM in quemu, which is performed on iphone.



    ♪ However, you still need to take care of manual copying of complex data types. To them. Not rows, numbers (int), bool - they are copied without problems, and all possible complex data structures are copied by reference, a deep-pyco library is needed for full replication (e.g. embedded dictionaries).

    ** It's possible to create a normal type of int for C using Cython. But it's only in CPython, as far as I know, and it's not part of the infrastructure of python-core.

    Supplement 2:

    At Python3 tach made it possible ♪ It's like living with everything. ♪ However, this is very rare because Python2 will not be ported, and because of interoperability naturally, this is rarely used. Official death date Python2 - 2020.

    The official position of the Python developers is for the work of the programme static analysers to detect errors. But I think it's also to make Python faster. In the past, all input requirements were written in docstring, there was no single format.

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2