Description
Book SynopsisJython is an implementation of the Python programming language, integrated with the Java platform. The secret to Jython's success lies in Java's architecture and tool set, and Python's rapid development. This work offers an introduction to the language, with reference material and examples.
Table of ContentsForeword Preface 1. Introduction to Jython Jython Requirements Welcome to Jython What's Jython Good For? The Benefits of Jython The Speed Question The Rest of the Book 2. Jython Basics Running Jython Basic Types Operators Numeric Types Sequences: Lists and Tuples Strings Mappings and Dictionaries Jython Files 3. Jython Control Flow Statements and Expressions Assignment Printing Blocks Conditional Logic Loops List Comprehensions Exceptions Evaluating Code Dynamically 4. Modules and Functions Modules Functions Parameter Passing with Style Import Statements and Packages 5. Object-Oriented Jython Creating Classes Methods Classes, Instances, and Access Control Inheritance Special Methods 6. Using Java from Jython Basic Object Usage Automatic Type Conversion Java Arrays and the jarray Module Java-to-Python Types: Automatic Conversion Collection Wrappers Avoiding Name Collisions 7. Inheriting from Java Basic Mechanics Java Interoperation and Overriding Calling Super Methods and Constructors 8. Reflection and JavaBeans Bean-Based Reflection Python-Based Reflection 9. Using Swing Java Versus Jython A Calculator An HTML Browser An HTML Source Browser 10. Using Java Libraries JDBC and the Python Database API Servlets and PyServlet Jython and XML 11. Jython Standard Library Using Python Modules System and File Modules Regular Expressions Serialization and Pickling Unit Testing with PyUnit 12. Embedding Jython Inside Java Setting Up an Interpreter Executing Code Accessing the Interpreter Namespace Using Objects PyObject Subclasses Catching Exceptions Embedding Examples 13. Compiling Jython Why Compile? The Compiler in Action Packaging in Java Archives Using Jython in Java A Simple Applet A. Installing Jython B. Jython Options and Registry C. Jython Exceptions D. Jython and CPython Differences E. Java-to-Python Quick Reference Index