
Résumé
Jython is an implementation of the Python programming language written in 100% pure Java, so it runs under any compliant Java Virtual Machine. The secret to Jython's popularity lies in the combination of Java's libraries and tools with Python's rapid development capabilities. With Jython, you can write Python programs that integrate seamlessly with any Java code. And like Python, Jython can be used interactively, so you can get immediate results as you are programming.
Jython Essentials provides a solid introduction to the Python language, offering a brief but thorough tour of the Python concepts you'll need to understand to use Jython effectively. The book makes frequent comparisons between Python and Java, with special emphasis on the different object-oriented semantics of the two languages, so Java programmers can quickly get up to speed with Jython.
Jython Essentials also covers the various ways in which Jython and Java can interact. For example, Jython code can create instances of pre-existing Java classes and call methods in those instances. You can write Jython classes that are direct subclasses of existing Java classes and use introspection to discern the capabilities of JavaBeans components. This book provides examples of using Jython with existing Java libraries, including the Swing GUI toolkit, the JDBC database API, the Servlet API, and various XML tools. And finally, the book shows how Jython can be used as a scripting language within a Java program.
With Jython Essentials, you have everything you need to start creating applications that mix the best of Python's interactivity and Java's robust libraries.
Contents
- 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 PyObjects
- 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
B. Jython Options and Registry
C. Jython Exceptions
D. Jython and CPython Differences
E. Java-to-Python Quick Reference
L'auteur - Noel Rappin
Noel Rappin is a senior software engineer at a large technology company, and has extensive Python experience. He has a Ph.D. from the Georgia Institute of Technology, where he studied educational software and user interface design. Noel co-authored the book Jython Essentials.
Caractéristiques techniques
PAPIER | |
Éditeur(s) | O'Reilly |
Auteur(s) | Samuele Pedroni, Noel Rappin |
Parution | 26/04/2002 |
Nb. de pages | 278 |
Format | 15 x 23 |
Couverture | Broché |
Poids | 422g |
Intérieur | Noir et Blanc |
EAN13 | 9780596002473 |
ISBN13 | 978-0-596-00247-3 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse