자이썬(Jython) 완벽 안내서

자바 환경을 위한 파이썬

저자:조쉬 주노, 짐 베이커, 빅터 잉, 레오 소토, 프랭크 비에쥬비츠키
역자:최용, 석우징, 정성태, 김성훈, 권찬영
버전:1.0, 2010년 3월 25일

이 책은 오픈 소스로 제공되며 크리에이티브 커먼즈 3.0에 준하여 사용을 허락합니다. 이 저작물은 자유롭게 복제, 배포, 전송 및 개작할 수 있습니다. 이 허가는 다음의 조건에 기초합니다:

저작자표시:

저작자나 이용허락자가 정한 방법으로 저작물의 원저작자를 표시하여야 합니다 (그러나 귀하나 귀하의 저작물을 추천하는 의미로 표시되어서는 안됩니다).

동일조건변경허락:

이 저작물의 개작, 변형물이나 가공물은 이 라이선스와 같거나 유사한 또는 호환가능한 라이선스 하에서만 배포할 수 있습니다.

저작자의 허가를 받을 경우에는 위의 조건 중 일부를 적용하지 않을 수도 있습니다.

라이선스와 관련하여 다음의 어떠한 권리도 제한하지 않습니다.

  • 귀하의 공정한 거래 및 공정한 사용 권한
  • 저자의 인격권
  • 그 외의 사람들이 가질 수 있는 권리로서 저작물 자체나 저작물의 사용, 즉 출판권과 개인적 권리 등

주의: 이 저작물을 재이용하거나 배포하는 경우에는 이 저작물에 적용된 이용허락조건을 명확하게 나타내어야 합니다. 가장 좋은 방법은 이 페이지로 링크시키는 것입니다. http://creativecommons.org/licenses/by-sa/3.0/

속표지

The Definitive Guide to Jython: Python for the Java Platform

Copyright © 2010 by Josh Juneau, Jim Baker, Victor Ng, Leo Soto, Frank Wierzbicki

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.

ISBN-13 (pbk): 978-1-4302-2527-0

ISBN-13 (electronic): 978-1-4302-2528-7

Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1

Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.

Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the US and other countries. Apress, Inc., is not affiliated with Sun Microsystems, Inc., and this book was written without endorsement from Sun Microsystems, Inc.

Lead Editors: Steve Anglin, Duncan Parkes

Technical Reviewers: Mark Ramm, Tobias Ivarsson

Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh

Coordinating Editor: Mary Tobin

Copy Editor: Tracy Brown Collins

Associate Production Director: Kari Brooks-Copony

Manufacturing Director: Tom Debolski

Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com.

For information on translations, please e-mail info@apress.com, or visit http://www.apress.com.

Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales.

The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. This book is available online under the Creative Commons Attribution-Share Alike license (http://creativecommons.org/licenses/by-sa/3.0/). You can read the book at http://jythonbook.com or check out the source at the book project on bitbucket at http://bitbucket.org/javajuneau/jythonbook/.

머리말

나는 2003년에 파이썬을 사용하기 시작한 이후로, 여러 가지 이유로 이 언어에 심취하게 되었다. 공백에 기초한 파이썬의 유려한 문법, 잘 표현된 내장 데이터 형식, 그리고 아름다운 라이브러리 함수의 모음. 그때 이후로, 다른 많은 사람들이 파이썬을 탐구하고 재발견해왔다. 이 글을 쓸 당시, 소프트웨어 산업에는 동적 유형 언어 -루비, PHP 그리고 파이썬-의 부활이 이미 도래해 있었다. 나는 2004년에서야 PyCon에 처음으로 참석하고 자이썬에 대해 알게 되었다. 사람들은 자바 가상 머신(JVM)에서 파이썬 프로그램을 실행할 수 있는 점에 매료되었지만, 당시 자이썬은 언어의 최신 버전을 지원하는 네이티브 C 파이썬(CPython) 번역기에 비해 그다지 관심을 받지 못했다. 개인 개발자들이 자이썬을 유지보수하고 있었지만, CPython과 보조를 맞추는 것은 개인으로서는 벅찬 일이었다. 2005년 12월, 프랭크 비에쥬비츠키가 자이썬의 개발자을 주도하게 되었고 그 후 몇년 동안 자이썬 개발자 모임을 키워왔다. 이 책의 저자들은 그 모임의 구성원이다. 2009년 6월, 자이썬 모임은 CPython 2.5와 동일한 언어를 구현한 자이썬 2.5를 내놓았다. 이것은 큰 도약으로서, 자이썬이 앞으로 CPython과 동등한 위치에 더욱 가까와지도록 하며, 나머지 부분에 대해서도 CPython을 따라잡을 수 있는 기초를 세운 것이다. 자이썬 2.5는 장고, Pylons, 그리고 SQLAlchemy 등 가장 인기있는 많은 파이썬 패키지를 실행할 수 있다. 자이썬은 파이썬 세계의 우아하고 인상적인 코드와 “기업을 위해 준비된” 자바 세계를 이어주는 최고의 다리를 놓아준다. 자바를 사용하는 조직에서 일하는 개발자라면, 자이썬에서 파이썬 프로그램을 실행함으로써 파이썬의 표현력과 간결함의 이점을 활용할 수 있다. 자이썬은 파이썬 코드와 기존의 자바 코드 간의 쉬운 통합과 상호운영성을 제공한다. 자이썬은 기존의 파이썬 프로그래머에게도 자바 가상 머신의 매우 풍요로운 생태계로의 namely access를 제공한다. 바깥 세상에는 막대한 양의 자바 코드가 있다. 무엇을 상상하든 그 이상의 라이브러리를 보게 될 것이다. 자이썬은 파이썬 프로그래머에게 이러한 라이브러리를 건드려볼 수 있는 길을 열어주어, 개발과 시험에 드는 시간을 절약하도록 해준다. 자이썬에서 구동되는 웹 애플리케이션 역시 톰캣이나 글래스피쉬와 같은 자바 웹 컨테이너의 확장성을 누릴 수 있다. 자이썬의 전망은 매우 밝으며, 이 책은 자이썬이 제공하는 이점을 활용하고자 하는 사람들을 위해 적절한 때에 주어진 자원이다.

Ted Leung

Back Cover Text

1부. 자이썬 기본: 언어 배우기

Indices and tables