Python Programming on Win32
Mark Hammond | Andy Robinson


Compras Nikon
Bluetooth
Python Programming on Win32 zeroes in on the strengths of the Python programming language for the Windows platform. If you would like to use Python on Windows with Office 2000, this book is a perfect choice for getting started. While it's not an introduction to Python programming itself, the book does present some basic Python examples. (The authors do provide an impressive list of real-world projects that have used Python successfully, including an application at NASA and a major Web search engine.)

In lieu of a general language tour, this book centers on practical tips and examples for using Python on Windows, beginning with downloading and installing the free Python package. The most useful examples here present a Python library for general accounting objects. You'll learn how to write COM servers in Python and then how to script them in Visual Basic (used here to build user interfaces) and how to control Word and Excel with OLE Automation in Python. One standout example looks at building and printing accounting reports in Office 2000 using Python as the script language.

Later sections look at other possibilities, including how to use Python's support for MFC to build user interfaces. A notable section here looks at Windows NT system administration in Python. Because of its built-in support for dictionaries, Python is a natural fit for working with users, groups, permissions, and the like.

While Python's initial habitat may be Unix, Python Programming on Win32 shows that this powerful and increasingly popular object-oriented language may find its next home on Windows. Provided you have some previous exposure to the language, this book is an excellent resource for using Python in a Windows setting. --Richard Dragan

Topics covered: Python programming quick-start, Windows Python basics, Python support for COM/DCOM, the Pythonwin editor, Office 2000 scripting, Windows NT administration and system programming, Python MFC programming, and Active Scripting.


1 Python and Win32 for Pinheads
If you know nothing about Python, Visual Basic, scripting languages, Win32 API, MFC, COM, active scripting, Windows Networking and NT administration, then after you've read this book you'll get some very general idea of what these all are about: this book covers them all, as well as many other things. But whenever it comes to tell you something really interesting, authors just say: "well, it's out of the scope of this book, so let's stop here..."

However, there are things this book does not cover. For instance, I thought scripting languages are a handy tool for text processing, but throughout this book I encountered only one mention of regular expressions - in the context of filtering file names, and you won't find regular expressions in the Index. From 10-page Chapter "Working with Email" you'll learn what SMTP and POP3 stand for, and from 15-page Appendix(!) "Threads" you'll learn that Python has something to do with threads, and fairly much about COM threading model.

Information in this 650-page book can fit a dozen-page article. Most of all this book looks like a slide show for marketing, trying to convince them that Python is the answer to all questions. And most of the time it sounds like: "It's easy, we won't tell you exactly what and how, but for smart guys like us who can read man pages, it's very easy."


2 Not for learning Python or programmin on Win32
This books is neither a Python tutorial book nor a Windows programming book. The title of this book greatly mis-represents the contents.

If you are not a Windows COM programmer who's trying to learn Python or are trying develop Python applications on other platforms, please look for other Python books.


3 Very good, misses a few spots
Python is the best choice for people who want to implement COM in the software they develop - mostly due to its clear structure and object - oriented nature. This is where this book mostly comes.

This book is well-written, practical-oriented and ideal for the newbie programmer who has already some idea over Python (O'Reilly's 'Learning Python' is the best place to start).

However, even experienced programmers need it because it provides a set of useful examples for rapid prototyping and reuse components.

It misses a few spots - First, you can't find much help on working on GUIs - and second (and most important) SWIG does not get the attention it deserves - it is just mentioned.

Finally, if you use Python in Win32 - or if you cannot decide what kind of COM solution you wish to develop - DO NOT CONSIDER TAKING A STEP WITHOUT THIS BOOK !


4 Very good, misses a few spots
Python is the best choice for people who want to implement COM in the software they develop - mostly due to its clear structure and object - oriented nature. This is where this book mostly comes.

This book is well-written, practical-oriented and ideal for the newbie programmer who has already some idea over Python (O'Reilly's 'Learning Python' is the best place to start).

However, even experienced programmers need it because it provides a set of useful examples for rapid prototyping and reuse components.

It misses a few spots - First, you can't find much help on working on GUIs - and second (and most important) SWIG does not get the attention it deserves - it is just mentioned.

Finally, if you use Python in Win32 - or if you cannot decide what kind of COM solution you wish to develop - DO NOT CONSIDER TAKING A STEP WITHOUT THIS BOOK !


5 Not a bad book
As I say in the title this is not a bad book. It's just not what I expected. The title is a bit of a misnomer, perhaps it should have been called "COM programming with Python". I had hoped to find some useful stuff on how to write GUI applications for Win32 but that topic was just slightly more than 40 pages in a book with over 600 pages. Still, I'd recommend it to anyone running Python on a Win32 platform.
6 Well written, and a key reference
Within a few hours of acquiring this book, it had enabled me to finish a project and save myself a lot of embarrassment at work.

The authors give is a detailed introduction to Python for Win32 developers - covering both system administration and back-end and front-end application development. It also provides an excellent introduction to COM (the Python/COM interface is the key component of the Win32 extensions). There is a nice progression from introductory material to quite advanced topics such as implementing NT services, or COM threading.

The range of topics covered is surprisingly broad. Also, the case studies are nice, and far from trivial: e.g. an accounting system that scripts Word and Excel, an invoicing system that produces PDF output.

The design of the Python Win32 extensions is admirable, so implementing COM clients in Python (e.g. scripting Excel) is simple - the online documentation is more than adequate. However, implementing COM servers (e.g. Excel-callable functions) is more subtle, and it would be unwise to attempt this without the information in this book. Hopefully a future edition will have more information on DCOM.

The section on GUI development is very helpful. I'm glad the authors covered wxPython as well as Tkinter - though less portable, wxPython is a much better framework on the Win32 platform.

There are some typos, but I haven't been confused by any so far.

The main difficulty with this book is that some of the information will become dated - the pace of development on both the Windows and Python sides seems to be rapid. Expect a second edition within a couple of years?


7 Essential Python + Windows Book
this book covers it all: com, dcom, database, etc. Whatever question you may have had about Python's capabilities & how to get the most from it on the Windows platform are answered here. The authors should be commended on such a fine offering. Books like this solidify O'Reilly's reputation as the premiere publisher of Computer books.

Thursday, 20-Nov-2008 08:34:14 CST
Quote of the Day:


Ninety percent of the time things turn out worse than you thought they would.

The other ten percent of the time you had no right to expect that much.
-- Augustine

Last night the power went out. Good thing my camera had a flash....
The neighbors thought it was lightning in my house, so they called the cops.
-- Steven Wright