Introduction to the Python Programming Language

Source: Internet
Author: User

The Python programming language is a true object-oriented language, but Barry Warsaw and Finn Bock are currently two of the most active JPython developers. Unfortunately, Jim Hugunin, the original developer of JPython, is no longer engaged in development.

David Mertz: What is JPython? Barry Warsaw: I will answer this question using a standard marketing statement. JPython is a 100% pure Java implementation of the Python programming language. It allows you to compile Python source code into Java bytecode and run the generated bytecode on any Java virtual machine. It is the most seamless and smooth integration with Java.

You can access all Java libraries from Python, build applets, integrate with Java Beans, and create subclasses from Java classes in Python, and vice versa. JPython is similar to Python rather than Java. It can be used for interaction. You only need to enter some JPython code on the prompt to see the result immediately.

In simpler terms, JPython can write scripts for any Java code you need, so that the number of lines of the converted code is 2 to 10 times less than the original number of lines. Because Python is a language for dynamic input, you can quickly develop applications with fewer errors and get more flexible programs.

Mertz: How did JPython Development begin? Warsaw: the Python Programming language was invented by Jim Hugunin. He now works for the Aspect Oriented Programming project of Xerox PARC. I know Jim. He may be interested in challenges. Many people in the Python field think this is not feasible. Guido himself is a skeptical. Jim proves that they are all wrong!

So why should we continue to develop JPython in the face of challenges? Because it is the most valuable Java tool that most Java programmers do not know. So far! Mertz: What do you think is stimulating the needs of JPython? Warsaw: First of all, we must understand that JPython is not a competitor of Java, but the best supplement to it. Java is a compilation language for static input.

This ensures that the database input is safe and the execution speed is faster. One interesting phenomenon is that although it is a bytecode translation, most people still regard Java as a traditional program of "writing, compiling, running, and editing. Of course.

Java utilizes the vast majority of the Software world, so there are many resources available for Java programmers. However, the same static input and traditional programming cycles increase Java application development costs in terms of human resources. Python wins in this respect.

Because Python is a small and simple language, it is very easy to master. Most experienced programmers can learn enough Python knowledge to increase productivity in about one day. Python is designed to read much more code than write. Therefore, Python source code is easy to share in large group projects.

But more importantly, Python is a very advanced dynamic input language. This greatly saves the amount of code required to execute tasks. Because the number of lines of code written in Python is small, it can be written faster with fewer errors. This is awesome for fast application development.

Python also provides an interactive interpreter, which means you can sit on the interpreter prompts, import Java code, create Java class instances, and call methods. All these are interactive. This is an excellent tool for training programmers to use the company's Java library or experiment with new Java APIs. But as I can see, all programmers should have CPython and JPython.

Mertz: As you can see, where is JPython better than the Python programming language? Bock: JPython provides complete access to its underlying implementation language. In most (possibly all) C-based scripting languages, C functions must be encapsulated in a simple code that exposes C functions to the scripting language.

There are some good tools, such as SWIG, to automate the creation of the package code. However, JPython does not require an installer at all. All previously written Java code can be used directly from JPython. Integration is bidirectional.

  • Adjust the speed of writing Python in the group
  • Correct Connection to the Python Database
  • Exploring a variety of Python languages
  • Explanation of the internal structure of the Python Project
  • View various features of Python applications

Classes and instances defined in JPython can be passed to Java, just as they are general Java classes and instances (and they do ).
Embedded/extended APIs make access to JPython objects from applications or modules quite accurate.

This advantage is partly from the fact that JPython and Java are both object-oriented languages. Jim took advantage of this fact.
Warsaw: CPython lacks access to a large number of Java code in the world.

To use the Java library, JPython is the answer. On the other hand, JPython has no simple access to all the existing C libraries in the world. Finn has finished integrating things such as Tkinter and POSIX modules through JNI, but those that are always non-standard in JPython because we want to retain 100% pure Java authentication.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.