Programming in Python 3: A Complete Introduction to the Python Language (Developer's Library)

Programming in Python 3: A Complete Introduction to the Python Language (Developer's Library)
Authors
mark summerfield
ISBN
0137129297
Published
26 Dec 2008
Purchase online
amazon.com

Python 3 is the best version of the language yet: It is more powerful, convenient, consistent, and expressive than ever before. Now, leading Python programmer Mark Summerfield demonstrates how to write code that takes full advantage of Python 3’s features and idioms.

Page 2 of 2
  1. Editorial Reviews
  2. Customer Reviews

Customer Reviews

said
Comments on Programming in Python 3 by Mark Summerfield

Overall this book is good , but it is _not_ for the novice, ie the beginner
to programming . Rating it is difficult as I know of only one other book
out on Python 3 : Python Visual Quick Start Guide. That is a too brief
outline, although it does contain some pearls for the beginner.

Setup is covered but, as the chapter title indicates, the coverage is "rapid".
It states Windows users will keep their code in the c:\py3eg directory.
No clue as to why this name was chosen or what the eg means.

I've struggled with the book for several months. It has been supplemented
with the online docs, other books and especially from the Internet
newsgroup comp.lang.python. I haven't read the whole book but I could not
have advanced beyond first base without the help of these other sources.
Things I claim are not in the book I could not find, although some may be
lurking somewhere.

At first I used the interactive interpreter ( >>> prompt ) to run single lines
or import and run modules. For weeks I was puzzled by a module running
once and then not running again when it was imported a second time. I had
to exit the interpreter and re-enter to run a module again. My question on
the above newsgroup was answered by Steven D'Aprano. Put what you want to rerun in a function named main() , or another name of your choosing.
After the module is imported it runs once. The next time you import it,
the module is already initialized and stored in the cache and nothing will
print. This is by design . After running a module, eg named alphasort.py ,
you can then type
>>> alphasort.main() and whatever is in main() will run again.
On p 35 of Summerfield's book it does discuss accessing a function of an
already imported module but does not mention the issue of the module not
running a second time.

I confess my modest background in c programming. Early I looked up arrays.
The index gives one page number for array module (p 207) and one for arraysize attribute. Page 207 describes the array module in one paragraph of 5 lines. Arrays must be initiated with a typecode, eg i for integer signed and I for integer unsigned. If this is in this volume, I cannot find it. I Iearned how to initialize an array from the Internet. In the book's index under sequence types the only array listing is bytearrays. Yet arrays of other types behave as sequences. Admittedly arrays are of lesser importance in Python; lists and other sequences dominate.

As a newcomer to a scripting language I felt helpless while there was
rumbling under the hood, results appearing on the screen and no interaction,
other than entering data with input() . I assume full interaction will have
to wait until one moves up a huge step to Windows GUI programming.
Some interaction can be achieved with scripting. There is a module msvcrt that contains getch() , getche(), ungetchar and kbhit(). With the useful kbhit() a pause function can be written :
>>>import msvcrt

def pause()
print('Program has paused. Press any key to resume.')
while msvcrt.kbhit() == 0 :
pass
print('A key was pressed.')
return

# in printing Amazon.com flushes all above lines to left
# of course the code under def should be indented 4 spaces
# and another 4 for pass

pause()

Summerfield's book does not mention the msvcrt module. This and
console I/O is discussed in Python in a Nutshell ( ver 2.x ) from
O'Reilly. To its credit Summerfields book does have a chapter 13,
the last chapter in the book, that is an introduction to GUI
programming and event loops.

Some of the explanations are difficult, or require a prior knowledge of computer science. For example consider wrap or wrapper. Simply this is a technique for fitting text to the column width of a page. This is mentioned on p 296. But there is something deeper. Consider p 347. Eight lines of code are given that return "wrapper". Text below : "Decorators define a new local function that calls the original function. Here the local function is wrapper(); it calls the original function and stores the result. . ."
Perhaps it's unfair to take things out of context.

As fundamental an action as printing to the printer is nowhere mentioned in
this book. From the Python newsgroup I found that this is done by :
printer = open('prn:','w')
printer.write(stringname)
printer.write('\n') # newline
printer.close()

To be fair Summerfield's book is 500 pages packed with advanced computing principles. Perhaps my criticisms have been of minor issues. My feeling for it will probably go up when it is compared with forthcoming version 3 books of similar scope. I feel it's between 3 & 4 stars but this should not be taken as a poor rating. Most programming books I would give 1 or 2 stars. Furthermore some of my struggling has been with Python and this will be regardless of any text. But the subtitle states it is a "Complete Introduction" . It is an introduction only to an experienced programmer and is detailed but not altogether complete.

eswph said
A previous reviewer mentioned his experience with Mark Lutz's book. I had a similar experience with Lutz's book too. Unfortunately, after what starts out with a very useful approach (one which should be widely used by other authors) of getting you up and running quickly, Summerfield's book falls into the same problems that Lutz's book had. Namely, it s very densely written, with no obvious separation in the text from what is the useful overall knowledge about a topic and what is the more arcane. I plodded through about the first third of the book, until I realized I was becoming confused about what I already knew about Python..so I quit. To be fair, the book is not intended as a tutorial so much as it is a reference. But I have to say, that it needs a major overhaul before it can be really useful in this context too. For example, more separation using white space, or sub heads, or something, should separate sections within a chapter, and separate examples and illustrations from unrelated previous or subsequent text. A little more use of emphasis or italics to highlight key text would be nice as well. And the font used for text and code is too similar, in my opinion. Especially when the code is inline with the text. That Summerfield knows Python is quite obvious. Too bad he and his publisher are not a bit more aware of how to present that knowledge to the rest of the world.

sylvainpronovost said
Very happy to have purchased this book, it covers all the basics and some more advanced ideas. I have been learning and re-learning Python programming over the last few years, and this book is a welcome relief from having to read textbooks where concepts and details fall in pretty random orders of complexity, sometimes working against the common sense pedagogy needed by novices.

A must have for a new generation of Python!

mwbookrevw said
Python 3 is a powerful language for web programmers and Version 3 is the best yet. PROGRAMMING IN PYTHON 3 covers everything from creating custom packages to spreading program workloads across multiple threads and programming SQL databases. It comes from a Python programmer who shows how to write code specifically for Python functions, and is a key recommendation for any serious computer library strong in web programming languages.

said
This book disappointed me in that it references source code files by name, yet does not supply the files. There is no attached CD/DVD, but the publisher promises downloads and updates if you register yourself.

Well, I registered and found that there is no source code despite reading about it in the text. Felt a little ripped-off by Addison-Wesley and InformIT.com. They have a blanket statement about 'availability' of these downloads - but if the editor allows multiple references to these files - how can the files not be available?

Writing to the publisher results in no response.

So, if you're looking for an introduction to Python 3.0 - this is an okay text and doesn't dive too deep too quickly for beginners. But, don't expect to get anything not affixed to the book as the online component is bogus. This is a slam against the publisher - not the author.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout