|
Characterized by ease of use, richness of expression, and concise syntax, Python has remained a premier programming language for more than a decade, and is used by novices and professionals alike. In particular, its close relationship to Java(TM) makes the two languages, when used in combination, ideal for Web and distributed enterprise application development. This tutorial begins with coverage of some of the basics of Python programming. Using plenty of skill-building exercises and interactive programming sessions, this book will help those new to programming develop an understanding of concepts and practical techniques. For experienced programmers, the book demonstrates Python's breadth of capabilities and shows the ways that Python interfaces with Java APIs for professional application development. Python Programming with the Java(TM) Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython covers important topics such as:
In addition, the book contains instructions for downloading and installing the Python language and the Java Development Kit (JDK). Terminology, definitions, explanations, and numerous code samples make this book a useful learning experience. Whether you are a sophisticated computer user new to programming or a serious application developer, Python Programming with the Java(TM) Class Libraries will give you insight into the power of Python and the know-how to put it to work. 777 |
|||||||||||||||||||||
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Addison-Wesley was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
The publisher offers discounts on this book when ordered in quantity for bulk purchases and special sales. For more information, please contact:
U.S. Corporate and Government Sales
(800) 382-3419
corpsales@pearsontechgroup.com
For sales outside of the U.S., please contact:
International Sales
(317) 581-3793
international@pearsontechgroup.com
Visit Addison-Wesley on the Web: www.awprofessional.com
Library of Congress Cataloging-in-Publication Data
Hightower, Richard.
Python programming with the Java class libraries : a tutorial for building Web and Enterprise applications with Jython / Richard Hightower.
p. cm.
ISBN 0-201-61616-5 (alk. paper)
1. Python (Computer program language) 2. Java (Computer program language) 3. Application software桪evelopment. I. Title.
QA76.73.P98 H54 2002
005.2'762梔c21
2002066565
Copyright ?2003 by Pearson Education, Inc.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the United States of America. Published simultaneously in Canada.
For information on obtaining permission for use of material from this work, please submit a written request to:
Pearson Education, Inc.
Rights and Contracts Department
75 Arlington Street, Suite 300
Boston, MA 02116
Fax: (617) 848-7047
Text printed on recycled paper
1 2 3 4 5 6 7 8 9 10桟RS?605040302
First printing, July 2002
Python is a dynamic programming language with the power of well-known languages such as Java, C++, and Smalltalk. In fact, Python is leaner and meaner than any of these languages and yet very expressive; it doesn't talk much, but it has a lot to say.
Python has another plus: the simplicity of languages such as VB Script and JavaScript, which makes it easy for beginning programmers to learn. Novices who know their way around a computer can pick it up quickly, particularly if they have ever created a spreadsheet that graphs and organizes data, written spreadsheet formulas, or created a Web page. For those who have, say, written macros and batch files or programmed in any language, Python will be a breeze.
Python was derived from a language called ABC created by Guido van Rossum and others in the early 1980s. The hope was that ABC's designed-in ease of use would become popular with novices as a way to get up to programming speed quickly and painlessly. This hope didn't pan out, so van Rossum began a new project, Python, which was released in 1990. He didn't forget ABC; in fact, there's a lot of ABC in Python's concise syntax and elegant expression, as well as in its ease of use. The formula worked this time; Python succeeded where ABC failed, and it has stood the test of time.
Put simply, my goal with this book is to teach programming using Python. You'll learn the workings of Python and how to apply them, particularly for the following:
Abstract Windows Toolkit (AWT) and Swing application development
Java applet development
Internet programming
Regular expressions and pattern matching
You may not understand these concepts now, but you will by the end of the book.
If you're looking for a full language reference, you won't get it here. What you will get is a deep enough understanding of Python to get started on your own programming. I'm going to remind you often of my belief that the best way to learn programming is by doing it. That's why I've provided lots of hands-on exercises in the form of interactive programming sessions, which I hope you'll follow along with at the keyboard as you read.
As a reader of this book, you may be one of the following:
A nonprogrammer who wants to learn a programming language
A novice programmer who wants to learn Python
For simplicity, I'll call you both novices. You know your computer and how to use it to get the job done.
If you're not a novice and you're reading this book, then you're an experienced programmer who wants to learn a higher-level language that's quicker and more powerful than the one you're using now. For simplicity, I'll call you programmers.
You'll be introduced to Python in conversational English, with many step-by-step examples. Chapters 2 through 9 build progressively on the chapters preceding them, so you should be able to learn enough to begin writing useful Python programs. The goal is to give you as much of a headstart as possible. From Chapter 10 on you'll learn more about Python and about supporting Java and Python libraries on your own, as well as about Internet programming with Python.
Most likely you're an experienced Java programmer who's aware of the close relationship between Java and Python and how it can lead to better application development (we'll get into this more in Chapter 1). You can skip over or skim the basic material and concentrate on the Advanced Topic sections and the various sidebars that are geared to your level of understanding.
Now let's get into our tour of Python梩he destination is worth the trip.
The author and publisher are grateful for the efforts of this book's developmental editor, Dianne Cannon Wood, and reviewer, Barry Busler. Countless hours and suggestions were extremely helpful during the book's production stages. Thanks.