Python: Create - Modify - Reuse and over 2 million other books are available for Amazon Kindle . Learn more


or
Sign in to turn on 1-Click ordering.
Trade in Yours
For a 0.25 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Colour:
Image not available

 
Start reading Python: Create - Modify - Reuse on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Python: Create, Modify, Reuse [Paperback]

James O. Knowlton

RRP: 26.99
Price: 22.63 & FREE Delivery in the UK. Details
You Save: 4.36 (16%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Only 1 left in stock.
Dispatched from and sold by Amazon. Gift-wrap available.
Want it tomorrow, 30 July? Choose Express delivery at checkout. Details

Formats

Amazon Price New from Used from
Kindle Edition 22.24  
Paperback 22.63  
Trade In this Item for up to 0.25
Trade in Python: Create, Modify, Reuse for an Amazon Gift Card of up to 0.25, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Book Description

4 July 2008
Python: Create–Modify–Reuse is designed for all levels of Python developers interested in a practical, hands–on way of learning Python development. This book is designed to show you how to use Python (in combination with the raw processing power of your computer) to accomplish real–world tasks in a more efficient way. Don′t look for an exhaustive description of the Python language––you won′t find it. The book′s main purpose is not to thoroughly cover the Python language, but rather to show how you can use Python to create robust, real–world applications. In this respect, the goal is similar to foreign–language books that identify themselves as “conversational,” focusing on the vocabulary and concepts that people will need the most. Likewise, I focus specifically on the Python knowledge needed to accomplish practical, specific tasks. Along the way, you will learn to create useful, efficient scripts that are easy to maintain and enhance. This book is for developers with some experience with Python who want to explore how to develop full–blown applications. It is also for developers with experience in other languages who want to learn Python by building robust applications. It is well–suited for developers who like to “learn by doing,” rather than exploring a language feature by feature. To get the most out of the book, you should understand basic programming principles. Because this book is project–based, you can approach it in numerous ways. You can, of course, read it from cover to cover. Chapters 2 through 8 each cover a different project, so the chapters are independent of each other. However, because each chapter project is covered individually, there may be some overlap of information. I also sometimes refer to explanations of particular topics covered in previous chapters. This will help to reinforce important concepts. The end of the book contains two appendixes. The first one is a listing of Python resources you can check out for more information. The second one will help you with installing additional components used in some of the examples. This book starts with a basic overview of the Python language, designed for those familiar with other languages but new to Python. It is followed by several chapters, each of which describes a complete project that can be used as–is or modified and extended to suit your particular purposes. You′ll find applications that access databases, take advantage of web technologies, and facilitate network communications, to name a few. In addition, and more important than the technologies you will be introduced to, you will learn how to use Python to solve real challenges. Following these chapters are two chapters that cover accessing operating system resources and debugging and testing, respectively. Each project chapter contains complete instructions describing how to install and use the application, so you can actually see the program run as you learn how to construct and use it, including how the project was designed and prototyped. This book is intended to be both a reference guide and a learning aid, teaching you how to build solutions with Python and providing reference information on a wide variety of Python programming concepts. It is hoped that this book will help you have fun with Python and build useful applications, and—unlike my experience with building a deck—without sore thumbs. This book is framed around the code itself. This is because developers are typically looking for how to do something; and, as with many activities, you learn how to do something by watching how others do and trying it yourself. If you want to know how a for loop works, you′ll find for loops in my code, but that′s not the thrust of the book. Instead, this book shows you how to do things: how to build a content management system, how to build a test management system, how to set up a system for tracking customer follow–up, and so on. Along the way, you′ll learn how to communicate with a SQL database, how to act as a web server or communicate with one, how to access operating system services, and more. There are three basic components to the book: Chapter 1 is a brief overview of the Python language. Chapters 2–8 cover seven different programming projects, which illustrate various technologies and techniques available to Python developers. Chapters 9–10 cover additional, advanced topics, which will help you as you build Python projects. The project chapters have a consistent structure: Overview: What does the application do? Using the program Design How it all fits together Modules involved Code and code explanation Module/class 1 explanation Module/class 2 explanation Minor code file explanation Testing, including suggested tests Modifying the project, including some suggested adaptations Summary Each project is designed with classes that can be reused and accessed for multiple purposes. This is one of the main benefits of object–oriented programming, so designing for reusability is a main focus of the book. The book contains the following chapters: 1. Python Basics This chapter is a basic primer on the Python language, and it functions as either a quick tutorial for experienced programmers new to Python or a refresher for programmers with Python experience. Part I: The Projects 2. Directory/File Snapshot Program This project demonstrates how to interact with files, create and manipulate data structures, and provide user output. It also touches on code design issues to improve code maintainability. Often when installing or uninstalling software, or verifying changes to a file system, it can be valuable to take a “snapshot” of the files and directories, along with their size and last–modified time. The script introduced in this chapter does just that. This chapter also explores how to capture a directory listing into a Python list, and explains how to query this list for particular values. 3. DVD Inventory System This project takes advantage of Python’s capability to access and manipulate data in a SQL database. The application enables multiple users to log in to a website that provides access to a DVD inventory database. Permissions are set such that some users can add, modify, or delete entries, whereas other users have read–only access to the data. 4. Web Performance Tester This project shows how to communicate with a Python web server and retrieve information regarding how long it takes to receive requested items from the web server. Although writing Python programs to work on a single computer can be useful, the real power of Python can be seen when it is used to script communication between computers on a network. Most networks contain several web servers. A nice feature of Python is that it can act as a lightweight server for various Internet protocols, such as HTTP (web) and ftp. This application enables you to monitor performance of HTTP traffic on your network. 5. Customer Follow–Up System This project shows how to present a web form to the user and retrieve data from it, how to automatically format and send e–mail through an SMTP server, and how to generate an HTML–formatted report. The task for the second example is to automatically generate a customer comments e–mail message based on information the customer enters in a form. It uses the mod—python Apache module to take the information entered in the HTTP form and then utilizes a Python script on the web server to send that information to an SMTP server for mail delivery. 6. Test Management/Reporting System This project makes use of the unittest module to run tests against an existing application, and creates a framework for reporting test results. Testing is a vital process for developing software. This application enables users to run tests for a given piece of software, to list the previous test runs by date, to show test run results for any previously run tests, and to output the results of any test run as HTML for viewing in a web browser. 7. Version Management System This project connects to a list of servers via telnet, checks the application version of a pre–set application list, and displays its results both as output and to a log file. Often, a system administrator needs to patch systems or ensure that systems have the latest application versions installed. This script is an easy way to accomplish that task. It makes use of Python’s capability to emulate a telnet client and log in to remote systems and perform functions on that remote system. 8. Content Management System This project explores Plone, a popular content management system based on Python and Zope (a Python–based application server). Because Python is a very mature language, numerous applications have been built on top of it. A great thing about working with Python–based applications is that you get the benefit of a full–blown application but you can still use Python to configure and customize it. Part II: Advanced Topics 9. Interacting with the Operating System When writing scripts “in the real world,” often it is critical to be able to access services available through (and particular to) the operating system you happen to be on. For example, suppose you wanted to read or modify the Window Registry? Or you wanted to get the Linux process ID of a particular process that is running? Is such a thing even possible? Definitely—and this chapter shows you how. 10. Debugging and Testing Because I am a software tester myself, testing is a subject that is certainly close to my heart. In this chapter, I discuss why testing is important, how to put the right amount of testing into your code, and how writing automated tests can help you to actually write code more quickly. You’ll look at PyUnit, the automated testing framework for Python, and learn how to use it to test the riskiest parts of a script. You’ll also explore the Python debugger and some of the nifty features it offers. Appendix A Where to Go from Here: Resources That Can Help This appendix provides an annotated list of books, websites, and blogs that can provide useful information, insight, and inspiration for t...


Product details


More About the Author

Discover books, learn about writers, and more.

Product Description

From the Back Cover

Python: Create–Modify–Reuse Aimed at all levels of Python developers who are interested in a task–based way of learning Python development, this hands–on book shows how you can efficiently use Python to create robust, real–world applications. After a brief primer on this object–oriented, interactive programming language, you will jump right into practical Python development so that you can create useful, streamlined scripts that are easy to maintain and enhance, and that you can immediately put to use in the real world. Each chapter features a complete project that you can use as it currently exists or modify to suit your particular purposes. Among these projects you′ll find applications that access databases, take advantage of web technologies, facilitate network communications, and more. Plus, you′ll also explore more advanced topics such as accessing operating system resources, writing scripts that are easy to read and maintain, and debugging and testing. However, even more important than the technologies you will be introduced to, you will learn how to use Python to solve real challenges. What you will learn from this book The various technologies and techniques that are available to Python developers Ways to communicate with an SQL database Tips for acting as a web server or communicating with one How to access and manipulate XML files Techniques for building a content management system Ways to access and communicate with your operating system Who this book is for This book is for developers who want to explore how to develop full–blown applications with Python. A general understanding of basic programming principles and object–oriented design is helpful. Create – Modify – Reuse guides are packed with unique, ready–to–use projects that are perfect for the busy programmer. The projects are created with minimal set–up, and can be modified, enhanced, and reused in real–world situations.

About the Author

Jim Knowlton is a software quality engineer with Automatic Data Processing (ADP), Inc., where he leads quality assurance efforts on ADP ’ s computer telephony integration and network video projects. He has been instrumental in introducing automated testing methodologies to their QA effort. He has more than fifteen years of experience in the software industry, including clients such as Symantec, Novell, Nike, and Zions Bank. He has extensive experience in open – source technologies, including Python, Ruby, PHP, Apache, and MySQL, and has also worked extensively in the areas of systems management and enterprise security. Jim holds a bachelor of arts degree in management and is currently working on a master of software engineering degree at Portland State University.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

Customer Reviews

There are no customer reviews yet on Amazon.co.uk.
5 star
4 star
3 star
2 star
1 star
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com: 2.8 out of 5 stars  5 reviews
6 of 6 people found the following review helpful
1.0 out of 5 stars Wanted to like this book but just couldn't 16 Jan 2010
By Aaron Dutton - Published on Amazon.com
Format:Paperback
I really wanted to like this book. As a professional C# developer, I have been learning Python the last few weeks. I got this book in hopes that it would provide some interesting projects.

I could not bring myself to like this book. It was a painful read because this book demonstrates poor and obsolete programming practices. I feel like this book would probably set a beginner back instead of helping them move forward. I would recommend almost any other Python book over this one.

The book does have seven fairly interesting projects, covering a wide breadth of the Python standard library (xml parsing, database access, file input/output, etc) and some web-based projects. That is why I wanted to like it. It covers interesting topics. However, this is not enough to make up for the sloppy editing, obsolete user interfaces, and poor programming practices. I will detail some of the problems below.

Sloppy editing - For example, look at the code sample at the top of page 31. This wouldn't even "compile" in Python's editor IDLE, because of the incorrect indenting.

....elif choice == "4":
........snapshothelper.showHelp()
.........else:
........if choice != "5":
............snapshothelper.invalidChoice()

The "else:" is intended wrong and then on page 32 the same code is excerpted except it has been copied incorrectly:
....elif choice == "4":
........snapshothelper.showHelp()
....else:
.........snapshothelper.invalidChoice()

You can see that the author corrected a mistake in the main block of code but then did not correct it in the excerpt.

This is just the tip of the iceberg for code blocks that will cause errors upon running them inside Python.

On to the next problem - The user interface for the command-line projects looks like something out of MS-DOS 3.1. In other words, it is extremely outdated, cumbersome and it's not even programmed effectively. The error messages are obtuse and don't even cover all the cases. Frankly, I expect a lot more from an author with an extensive background in testing. For example, in page 70, the "elif" block never checks for choices that are not 1 through 5. If you have an invalid choice it will cause a SQL error and print the error message "THERE WAS A PROBLEM MODIFYING THE RECORD" even though the error was caused by an invalid choice.

My final complaint is that the author does not follow Pythonic practices or even best practices from other languages. For example, the Try-Except blocks (page 79 for example) include large swaths of code instead of just the small section that will actually throw the exception. Also, the Except clause does not catch particular error classes but instead every error. These violate basic best practices for any language. Another example of not being very Pythonic is the lack of list comprehensions like on page 37 (also note that this sample includes inconsistent indentation and would likely cause the Python interpreter to fail):
....for item in filelist:
............if item.find(extension) != -1:
................snaplist.append(item)

This could easily be re-written in the Pythonic way:
....snaplist = [for item in filelist if item.find(extension) = -1]

Unfortunately, I could go on and on talking about things I don't like about this book. The bottom line is that I don't recommend it.
8 of 10 people found the following review helpful
1.0 out of 5 stars Mediocre book and poor accompanying source 22 Sep 2008
By B. Bowling - Published on Amazon.com
Format:Paperback
I was very disappointed by this book. I have come to expect more from WROX than this. If I was given this book without a cover, I would never have guessed the title. The book is organized more like a cookbook of projects that each illustrate a particular point or technique than a book titled "Create - Modify - Reuse".

The source code in the book is broken into fragments and isn't usable by itself. You will need to download the accompanying source from the publisher to run the programs. Unfortunately too much of the downloaded source is broken and has to be fixed before it will run. The style and organization of the code reminds me of a first year student's programming assignment.

I'm just glad I only borrowed this book from the library and it had to go back anyway.
1 of 1 people found the following review helpful
3.0 out of 5 stars Broad overviews 3 April 2010
By Christopher Overton - Published on Amazon.com
Format:Paperback|Verified Purchase
This is not a bad book, it just isn't a book for beginners. There is not a whole lot in the way of troubleshooting and if something that the book has you do does not work you more or less have to hack the code together yourself to get things off the ground. The community site that partners with this book and others in the series is a wasteland really. It doesn't seem to be active with many of the forum section completely barren and the forums sections with discussions have been inactive for several months if not years. In other words don't expect a whole lot of support from anywhere regarding what you read here. All in all though the book does have some interesting coding and can really help broaden intermediate coders perspectives on how to code in Python.
1 of 3 people found the following review helpful
4.0 out of 5 stars Good for 2 days weekend to learn your new powerful language 26 Oct 2008
By Jedt Sitthidumrong - Published on Amazon.com
Format:Paperback
Well, not that bad 1 star.

I've tried to find a book that teach me python about, command line interactive, file read/write, CSV & MySQL full application (not a GUI but in the console interactive).

All of the examples are using project as a guideline. The code is easy to follow and the author explain well (IMO, a bit too detail for the some same topic that no needs to explain)

So, in the nature of Python, we have to download additional libraries mostly. So, for most the code examples are work for me.

I'm happy about this book very much. SInce I'm looking for a book that can teach me Python in a few days and can read + understand how to use python in each project by reading the book mostly. So, I can now move to the more detail books like Core Python or Python in Nut Shell, etc.

What I would like the book to have is about using web framework like Django, TurboGears or Pylon. The book use Plone. No question about how good Plone is but the little chapter for it is too superficial for Plone and it can be read from many websites. So, I think it'd be a popular and more lightweight framework like Django, Pylon, TurboGears.

If anyone have a few days even far from your computer. You can learn Python easily by the book and for most programmer, it's no need to type (but recommend) since the book describe the code in detail.

Recommend for people who want to know python quickly. Then you'll jump to next Python books like me :-)
2 of 5 people found the following review helpful
5.0 out of 5 stars Learn Quickly by Doing 3 Nov 2008
By V. Berube - Published on Amazon.com
Format:Paperback
The approach that the book takes really caters to my learning style i.e. learning by doing. Normally the programs you write in IT books are useless but to my delight, most programs in this book (8 in total) have potential for immediate usage at home and at work, which makes it that much more rewarding to go through them.

This is a great way to quickly learn programming for those of you that already know some of the basics. I can't wait to see more books out of the "Create - Modify - Reuse" series.

The author also makes it really clear that the first examples are not optimally designed in order to keep things as clear and simple as possible - OOA&D snobs should look elsewhere. Besides, starting a little loose on encapsulation just affords more repetition to reinforce the key Python concepts.
Were these reviews helpful?   Let us know

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 

Search Customer Discussions
Search all Amazon discussions
   


Look for similar items by category


Feedback