Python 3 for Absolute Beginners
As you’ve seen, text is integral to most Python programs, and you saw how often of our examples use it. We take text input from users, manipulate that text, and display messages in response. This is why Python comes with so many text-related features. In this chapter, you learned how to split and join strings; format, edit, and search for strings; use regular expressions to search for patterns within strings; and work with the files on your file system. We then applied much of this in our example application. 160 C H A P T E R 8 ? ? ? Executable Files, Organization, and Python on the Web Up to this point, you’ve been running your scripts via the python interpreter. This is all well and good, but it would be nice if we could get the scripts to run by themselves, just like real programs, so that’s just what we'll look at first. I’ll then cover how to organize and spruce up your code, because clean, organized code makes you more efficient and gives you time to write even more lovely Python code. This leads us onto some of the dynamic features of Python: modules and the exec() and eval() functions. These features give you more flexibility and choice when writing Python applications.
What people are saying - Write a review
Python 3 for Absolute Beginners, Tim Hall and J-P Stacey, Apress (ISBN: 978-1-4302-1632-2)
Disclaimer: I was asked to review this book through the Hampshire Linux User Group. I did not receive any instruction for the outcome of the review nor any payment for the review (though I did get to keep the book).
I believe it is important to know something about a reviewer of a book, so that the statements made can be fully appreciated. I am a Software Developer, so spend most of my day reading and writing code. These days it is mostly Perl and Java, though some days it is all C++. I have never written Python before, though I have poked at about two scripts (and even made a fix to one), but it is probably fair to say that I have spent less than an hour looking at Python code before reading this book.
The book does actually mention that the source code examples are available for download from Apress.com however it is mentioned on the first inside page where all the copyright information is (and which you normally skip over automatically). If you want the exapmles, they are at http://apress.com/book/downloadfile/4500
The book opens fairly well for a beginners book, and seems strongly aimed at someone who has never programmed before (I have heard lots of people recommending Python as a good language to teach yourself programming with and can understand why). I was pleased to an early reference to Monty Python as well, as this is where the name Python comes from.
The use of Python's interactive interpreter is excellent and it makes for great examples of simple parts of the language, while also being so short that you actually want to type them into your computer and try them out! In particular the author's use of Pythons interpreter to print out details of a data-type or variable, and even the outcome of comparisons (e.g. entering "1==2" into the Python interpreter returns "False" without having to actually use a print statement or any other debug methods which I think is fantastic for a new programmer and a real time saver)
It is a shame that the author fails to stress the differences between Python 2.x and 3.x strongly enough. While some code will work on both versions, there are very large changes and it should have been made more clear early on that Python 2.x code is unlikely to work in Python 3.x, and vice-versa, as I would expect users to also seek examples on the web and it will just be confusing if the examples don't work because of changes between versions of Python.
By chapter two some software design principles have been introduced alongside the first actual program, which is of course "hello world". The author spends a long time talking about Software Engineering and Design principles, which is all valuable information, but I doubt many readers will actually spend time reading this and will instead skip over it. It does cover pretty much everything from design approaches (inside-out vs top-down) all the way to code control, versioning, comments, documentation, etc so certainly tries to cover all the bases.
The book then moves on to explaining variables and datatypes, operators and precedence, integers vs floats and all the core basics of a language. I initially thought that explanations of Octal and Hexadecimal values were perhaps a little advanced for a book aimed at "Absolute Beginners", but the author did make a good point that these are often used in file permissions and html colours and this makes them very useful to know.
The examples in the book start off short and sweet, but at some point the author had the idea to continually rework a text-based RPG game he invented for the book. The only problem with this is that you end up staring at several pages of code, and all you want to do then is skip over it, and then start skipping the explanations of this long code. I think the author was trying to teach some good refactoring techniques throughout the book by using this larger piece of code, however I feel that shorter, separate