Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Core Python Programming

Posted by samzenpus on Mon Nov 06, 2006 01:54 PM
from the code-it dept.
Ravi writes "Python, the dynamic object oriented programming language created by Guido van Rossum is known to deliver both the power and general applicability of traditional compiled languages without the complexities accompanying them. Coupled with its ease of use, programs written in Python can be run on multiple Operating systems and system architectures which gives it the same portability of any interpreted language. My first brush with Python was when I tried out a beautiful game called PySol — which is more like a collection of over 200 card games and PySol is entirely coded using the Python language. Nowadays a variety of Python web frameworks have also cropped up which promise the same kind of rapid application development that is possible using other programming languages." Read the rest of Ravi's review


I found the book titled "Core Python Programming" authored by Wesley.J.Chun and published by Prentice Hall to be an ideal book to learn the wonderful Python language. This book is quite voluminous, with 23 chapters spanning 1050 pages. The book is divided into two parts the first part titled Core Python which contain 14 chapters which impart a sound understanding of the semantics of the language and the second part titled "Advanced Topics" which contain a collection of 9 chapters which give a good introduction to the specialized uses such as in database programming, network programming, using threads in python, GUI programming and so on.

In the first chapter of the book, the readers get to know the various features of Python and the steps needed to install Python on ones machine. When you install Python on your machine, it also provides its own shell where you can execute pieces of python code. The author has taken advantage of this functionality of Python in narrating the concepts throughout the book. Each concept and syntax is followed by bits of code which the readers can try out in the Python shell in its entity. I found this process much easier in learning this language as one need not go through the write — compile — execute cycle which is more prevalent in the traditional languages.

In depth coverage has been provided for important concepts such as lists, tuples and dictionaries as well as data-types and string sequences and they have been provided separate chapters of their own. The sixth chapter titled "Sequences: Strings, Lists and Tuples" is the second largest in the book and is quite detailed in its coverage of the topic.

Chapter 9 deals with file manipulations where the author introduces all the built in functions available in Python which allow one to open, read from and write to a file. Interestingly, the functions are also illustrated by aid of short easy to understand examples. A couple of modules related to file handling are also introduced in this chapter.

Errors and exceptions form the basis of the 10th chapter where different errors and exceptions supported in Python are explained. This chapter also explains how programmers can create custom exception classes which I found quite informative.

One of the biggest advantages of Python is that all its functionality is split up into modules. A module could be just a single python file which contain a collection of functions or classes which can be re-used in programs written in Python. And all one has to do is import the module into ones programs to start using those pieces of code. The chapter 12 titled Modules give a firm understanding of this concept and also introduces different ways in which you can import external pieces of code into the Python program.

Chapter 13 titled "Object Oriented Programming" is by far the largest chapter in this book and spans over 100 pages. In this chapter, the author endeavors to give a sound base to Object oriented concepts as well as how they relate to programming in Python. The author introduces a large number of Python classes, methods and descriptors in this chapter.

Regular expressions play a very important part in programming verily because manipulating text/data is a necessity. And it is possible to easily modify and mould data to ones choosing by way of regular expressions. Python has strong support for regular expressions. The second part titled "Advanced concepts" of the book starts with a chapter on regular expressions. In this chapter, one gets to know about the regular expression module and many functions associated with the module. The author also provides a couple of examples which give insights into the ways in which regular expressions can be used in Python to reformat data.

The next two chapters give an introduction to the world of sockets and how Python can be used to write client server programs.

Multithreaded programming forms the basis of the 18th chapter. Here the author introduces a couple of modules available in Python which make it quite easy to create threads in ones Python program.

I found the chapter titled "Web Programming" very interesting to read. Especially since Python is used in a large way to create dynamic websites. And the next chapter titled "Database programming" gives a sound introduction to the Python objects which allow one to easily connect to and retrieve data from the databases.

I found this book really informative, especially suited for upcoming Python programmers. At the end of each chapter, there is an exercise section which imparts a nice touch to this book as it allows you to test your knowledge. Even though the advanced topics (second part of the book) are not covered in depth, the author succeeds in providing enough knowledge about the relevant Python modules and functions followed by a couple of examples which whets ones appetite without overwhelming the reader. This is the second edition of the book and it has been significantly revamped to include new features introduced in Python 2.5.

The author Wesley J. Chun has been a former employee at Yahoo and has played a major role in creating Yahoo Mail and Yahoo People Search using Python. He has over 20 years of experience in the IT field with over a decade of experience programming in Python.

Ravi Kumar likes all things related to open source and free software and enjoys sharing his experiences and thoughts through his blog All about Linux.


You can purchase Core Python Programming - 2nd Edition from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • by Dr. Smeegee (41653) on Monday November 06 2006, @02:12PM (#16738981) Homepage Journal

    One might try out Alan Gald's fine Learning to Program [freenetpages.co.uk] site. Short on pretty. Long on usefulness.

    Oh, and all the thick books in the world will never help a budding python coder more than the tutor mailing list [python.org].

    • by leoPetr (926753) <leo.petr@gmai l . c om> on Monday November 06 2006, @02:22PM (#16739137) Homepage Journal
      For that matter, the Official Python Tutorial [python.org] is doubleplusgreat. It's both well written and comprehensive.
      • by CustomDesigned (250089) on Monday November 06 2006, @03:36PM (#16740479) Homepage Journal
        I use LiveWires [livewires.org.uk]. I teach a high school programming class with 7th graders. The adult oriented tutorial is a little too steep for them. They move along just fine with the LiveWires course. Also, the example projects are games. :-)

        An interactive (has an immediate mode prompt) language like Python is very helpful for first learning. BASIC used to fill that role, but I like starting with structured concepts. Kids have no problem "getting" that indentation marks blocks.

        Some experts hate python because while the grammar is "context free", the lexing isn't. The grammar is defined in terms of INDENT and OUTDENT taking the place of '{' and '}' (or BEGIN and END). However, whether a given indent is an INDENT or OUTDENT depends on context. So you can't use a traditional lexical analyzer when programmatically generating/modifying python code. You have to translate leading whitespace to INDENT and OUTDENT based on lexical context when parsing, and translate INDENT and OUTDENT to the appropriate amount of leading whitespace when pasting code blocks.

        Personally, I don't find that this is a problem. Sure 'lex' doesn't work out of the box, but the custom lexing code is pretty trivial. And the indentation sure is intuitive. Maybe that means I'm not an expert.

    • I've been using How to think like a computer scientist: Learning with Python [greenteapress.com]. It's useful, but a bit terse. My programming skills are rather limited and rusty, so I got stuck halfway through the book. People who program for a living will find the book easy to digest, I expect.
      • It sure is handy! One can actually get decent advice from at least one O'Reilly book author who posts pretty regularly. It's very low-noise and calm. I have never seen a RTFM. :-)
      • If you've ever written code before Dive into Python is the way to go. It is free on the web and also available in print from APress. I am a big fan of books of this style which assume that you already have some knowledge of basic programming and focus on the specifics of the new language.
  • has documentation too...
  • Unless Chun has changed the focus a lot, the book takes a fairly introductory stance on things. There's a lot of material explaining programming practices, OO and so on. If you're experienced with C/Perl/*nix development, you're probably better off with an O'Reilly book, or something else that has more reference material.
  • Where's the review? This was a sketchy synopsis. How about the writing style? Does the code use modern idioms? What did the examples cover -- are they real-world or contrived? Hell, is the typeface clear?

    It's no wonder I skip straight to the comments -- these reviews are just about the most content-free section of slashdot.
  • Q: How many Python programmers does it take to screw in a lightbulb?

    A: That joke's not funny.
  • portable gui (Score:3, Interesting)

    by Speare (84249) on Monday November 06 2006, @02:33PM (#16739349) Homepage

    After a year of fiddling with Python, I find I quite like it for some things, and it's not the right fit for other things. That's fine, there's no reason to be rabid pro- or rabid con- about any language.

    I happen to use Linux, OSX and Windows, and the number one annoyance for me is a lack of clear "native-looking" GUI or OpenGL toolkit offering that is reachable by scripting languages like Perl and Python.

    I'd like to see PyGame in a MacPort. The Images module was pretty easy to build but it should be in MacPorts too. I don't want to rely on X11 when on a Mac, but to use X11 when on Linux, which seems to be like bringing antimatter and matter together in the same universe. A GladeXML-like module that relies only on Aqua would be great.

    Similarly on Windows, you're relegated to some fugly Tk choice if you want portable GUI. I can't think of a toolkit that looks less native than Tk, unless you count the early Java Swing "Metal" theme.

    The fact that OSX still isn't standardized on python2.4 makes it hard to support python-rich applications like Blender, and we still run into problems where a 2.3 parser can't let scripts use 2.4 features (even smart scripts that try:except: to fall back gracefully). I think Leopard will be python2.4 but don't recall seeing official confirmation on that.

    I'm sure I've misstated something technically-- I don't have my notes from home to double-check a few things from my last gui toolkit search a couple weeks ago.

    • Re:portable gui (Score:4, Informative)

      by jamwt (220439) <jamwt@NOSPAM.jamwt.com> on Monday November 06 2006, @02:43PM (#16739517) Homepage
      How about wxPython? [wxpython.org] Or, if you prefer, PyQT [riverbankcomputing.co.uk]? Both excellent.
    • WxPerl [sourceforge.net] looks fairly native to me. I tried it out a few years ago, but haven't stuck with it since I switched to an OS that it doesn't support.
    • Re:portable gui (Score:4, Informative)

      by Electrum (94638) <david@acz.org> on Monday November 06 2006, @02:45PM (#16739575) Homepage
      I happen to use Linux, OSX and Windows, and the number one annoyance for me is a lack of clear "native-looking" GUI or OpenGL toolkit offering that is reachable by scripting languages like Perl and Python.

      wxPython [wxpython.org] is native on X11, Windows and Mac OS X.

      I used PyOpenGL [sourceforge.net] a few years ago and it was a very pleasant experience. It was easy to translate C examples to Python, without all the annoyances of using C. Obviously you wouldn't want to write a full game engine using Python, but it is nice for experimenting with OpenGL.
    • Re:portable gui (Score:4, Informative)

      by vivek7006 (585218) on Monday November 06 2006, @02:48PM (#16739635) Homepage
      I happen to use Linux, OSX and Windows, and the number one annoyance for me is a lack of clear "native-looking" GUI

      QT [trolltech.com] with python bindings PyQt [riverbankcomputing.co.uk] will give you native looking GUI on all three platforms you are interested i.e windows, linux and OSX. Now QT4 is available as GPL even on windows, so its truly "free". QT also comes with QT-designer which IMHO is the best rapid GUI designer app.
      • wxWidgets comes with a binding for quite a few languages, and support for a lot of platforms, including PDAs. wxPython is pretty cool.
  • BN is overpriced (Score:3, Informative)

    by Electrum (94638) <david@acz.org> on Monday November 06 2006, @02:39PM (#16739455) Homepage
    Save some money:

    Amazon.com [amazon.com] $32.99
    Overstock.com [overstock.com] $31.34
    Half.com [ebay.com] $28.95

  • For anyone who has ever programmed before, the O'Reilly Python Pocket Reference is all that you need to start. I say that because Python is so simple to learn that I am afraid that some giant book might end up being a hindrance rather than an asset at the start. You might lose sight of just how simple a language it is- yet its very powerful and extensible. (the Pocket reference is around $9 or $10)
      • That looks pretty cool. I should also point out that Python comes with excellent documentation that by itself is more than enough to learn the language. I just like little portable books rather than online docs or printed paper.
  • I'm sorry but Python is a VERY easy language to learn plus inherently object oriented (although it impressively supports the functional paradigm as well). How is it that you can get all the way to chapter 13 in a book about python before talking about its OO features? I'm not seeing much value here...
  • Few web-hosters have python to begin then. Then I read that for python to perform well requires mod_python 3.X, which in turn requires Apache 2.X. Practically no web-hosters use apache 2.x.

    Popular frameworks like TurboGears, or Django, also require mod_python 3.x and apache 2.x.

    No problem if you are developing internally, but if you want a hosted solution, I'm not sure if python is practical.
    • Sometimes it's worth spending nights writing and optimizing C programs to gain just a few milliseconds, sometimes you just need to write a small script in either Python or Ruby to automatize a task you'll never do again.
      In this case, would you really care about execution speed? I'll just go for the ease of string/files/array/hashes manipulation, write a powerful script in 10 minutes and go drink a coffee while my script works for me and you're still struggling with your char str[80];.
      • Not necessarily a "char str[80]". Many people forget that C++ isn't just "C that lets you do proper OOP", it's a better C and plenty of string classes, file access classes, array and hash classes exist for C++.

        Of course I doubt any of them are as easy to use as Python... but I wouldn't mind betting there are some C++ library guru's out here in the /. crowd familiar with enough to whip up something almost as quick as you can in Python.
        • Well C was written as a readable assembly language and there
          has been 20 plus years of optimisation going on there, so,
          you have got to be a shit hot assembly programer to beat pure
          C on speed.
          C++ is considerably slower and harder to read ( flambait ;-).

          The interesting thing is that well written Pyhon applications
          run about the same speed as well written Java.

          The key phrase here is "well written" and you really do have to
          be aware of what pyhon is doing the classic being
          python " for x in range(1,1000)"
      • It is worth looking at the way that Python is used in the game industry. Quite a lot of shops use it in a heterogeneous environment where the core functionality, e.g. graphics, physics, control/hardware, etc are in highly optimised C with inline assembly but Python acts as a glue pulling them all together and scripting most of the actual gameplay. There are books on this, but it is more than just theoretical. I interviewed at a shop that does exactly this for the console games they produce.
        • Re: (Score:3, Insightful)

          It really depends on the application. Python is really easy to use and for applications that aren't cpu/io intensive it could prove better to use over a language such as C just because it's much easier and quicker to put together something relatively small together. However, once the requirements start to grow it's a completely different scenario. As soon as you're going to be writing an application that's going to take a few seconds to execute an operation, then a faster language such as C might be a bette

          • Re: (Score:2, Informative)

            hmm... I have had similar experiences but with lots ofspecial cases. in string processing, python is second to none. the lack of execution speed never shows up and writting string handling code in python is amazingly easy. Ditto in dbs. In numerical calculations though, python is a bad idea for anything except testing out an algorithm. thats because in python, everything even integers, floats, and chars are kept on the heap in pyobjects. so when somebody does x = y + z where y and z are integers, whats real
            • Re: (Score:2, Informative)

              The ICFP contest [icfpcontest.org] allows any language you want. It's once a year, with 3 days to work on the problem. Typically it's a single optimization problem for which a perfect answer is not feasible in terms of computation, so the best heuristic wins.

              The Internet Problem Solving Contest [ipsc.ksp.sk] also allows any language, since you only have to submit the output, not the program. It's also once per year. It has multiple problems and you have to solve as many as possible in 5 hours.

          • It also depends heavily on whether you're using idiomatic Python. If you're doing a straight translation of algorithms from another language, chances are you're unnecessarily introducing performance problems. Quite often, the optimal approach in C/C++/Java is not the same as it is in Python. Often the "obvious" approach in Python is the fastest (in particular - use the built-in types!).

            For example, in C/C++/Java a switch is often the fastest way to make a multi-choice decision. Python does not have a switch
              • > As for the switch statement in C/Java, it's actually no longer any faster then a bunch of if statements since the modern compilers optimize them to the same machine code.

                I think you mean that some compilers may optimize a bunch of if statements into jump tables, the same way they've been doing for switch for well over a decade. Python could perhaps do jump table optimization for a switch opcode, but you'd be micro-optimizing something that would either barely benefit or would benefit more from a redes
              • As for Python though it's a different story since it's interpreted.

                Actually, Python is byte-code compiled at run-time. You can see this in action after you run a Python app one time, you will see a .pyc file - that is the compiled version which gets executed by the Python virtual machine.
          • Also remember - taking the exact same algorithm between different languages may be misleading. In the case of python, there are more 'pythonic' language constructs that obviate the need to use particular algorithms - and also may provide speed above and beyond what you would find using the traditional algorithm.

            So, this, for instance, is a Pythonic way of getting multiple return values from function:

            def something():
            return "Foo", "Bar"
        • Re: (Score:3, Insightful)

          Then dont pretend that Python is an all purpose programming language and admit/accept it for what it really is : An overhyped, scripting language, a better PERL in some aspects if you will.

          It *is* a general purpose programming language. Well, it is as well suited to 3d games programming as C is to a web application; and nobody would dare to say C is not a general purpose programming language.

          I know you said "all purpose programming language", but then again, for that matter no language is "all purpose"

        • A minority of applications are actually CPU-bound. Most applications are I/O-bound and can't be optimized. Most "general purpose" applications won't benefit from being written in C.
        • C becomes an all-purpose language under the hypothesis of infinite development resources. Python becomes an all-purpose language under the hypothesis of infinite computational resources. Neither hypothesis is true, but either might be a useful approximation of a given situation.

          Anyway, the whole question is rendered moot by the ability to embed Python in C++ and call C++ libraries from Python. It might seem ironic to you given your preconceptions, but Python brings C++ much closer to being an all-purpo

    • And Java is far slower yet it gets all the ink why? Because Sun was seen as an upstart taking on Microsoft in the days before open source was the big thing, and now Sun is not so loved. In the aftermath of the hullaballoo, Java remains a slug of a language implementation.

      Meanwhile, I can whip up apps in Python in no time and they run far faster and with less nonsense and hassle. Slower than C? Yes. Better for rapid prototyping and quick problem solving on the fly? Yes. Best language I know to bridge structu
      • java is quite competitive these days re: execution speed.

        Do keep up old chap.
        • Re:Python is SLOW (Score:5, Interesting)

          by Ashcrow (469400) on Monday November 06 2006, @04:06PM (#16741245) Homepage
          It really depends on what your doing with it. If you come from the Java world and write Python code like you would Java code it is quite slow.

          Also, keep in mind Python does not use a virtual machine at all in the same way Java does -- which means it is somewhat like comparing apples to oranges.

          I was a full time J2EE engineer for a while and a recent convert to Python for general programming. The things I noticed are:

          - Java is great for large teams of programmers working together across the globe but as good as Python for smaller groups in the same place.
          - Python's web frameworks are amazingly fast and very powerful.
          - Java is almost text book perfect when it comes to programming. Unlike most other languages kids can come out of university and not have to change hardly anything to get started in the real world of Java.
          - It's very rare to see stock Tomcats or even stock JVM's meaning that most (commercial) Java apps send the entire 'Java OS' (VM) with their products.
          - Java web apps are very slow on startup, but scale well after the startup time.
          - Python has a better RORA system, though Java isn't to far behind.
          - Java terminology is very confusing compared to Pythons esp. since it is generally termed by marketers (Java2 is Java1.4 and then we hit Java 5 which is Java1.5 ...)

          Here is how it seems companies leverage the languages ....

          1. Java
          Manager's reason for Java: "I have a large IT infrastructure and want to do enterprise applications with teams across the globe."
          Engineer Translation for Java: "I have an over all large group of engineers and want to make an application designed by the business with at least some of the team out sourced."

          2. Python
          Manager's reason for Python: "I have a small IT budget and want to agile and business reactive application development."
          Engineer Translation for Python "I don't have a budget to get more engineers and the requirements state that we need to be able to change and update the application on the business whim."

          In scenario number 1 it is a growing company who wants to hire lots of new engineers so the plus side of using Java is:

          1. Just about every engineer (good or bad) knows it
          2. It enforces C++ like development cycles
          3. If done right, the objects are reusable and simple for an architect to understand
          4. You can hire fresh outs

          In scenario number 2 it's a growing company who is not investing more money in the IT department but expects better results for the buck put into it. The plus side of Python would be:

          1. It's a RAAG language (read at a glance) which means you can skim through the code quite quickly without needing tracers or debuggers.
          2. By design each engineer is a mini architect
          3. If done right, the objects are reusable and simple for engineers to grasp quickly
          4. The quality of engineers you get tend to be quite high since most Python engineers are converts from other languages with X years of experience in the field. (though it also means you can't hire as quickly).

          Bottom line there is no right or wrong answer as to which is better or faster. Python is faster in some cases and Java is faster in others and it largely depends on how you run your business and the money that you want to spend in IT as to which one would help your company.
          • Java is great for large teams of programmers working together across the globe but as good as Python for smaller groups in the same place.

            This is awfully debatable. The explicit static typing and ease of static analysis makes error-checking much easier in Java, which makes for much easier QA if you don't like testing. Java also have very good IDEs, which it doesn't deserve. But the verboseness of Java and it's lack of many (syntactic or other) niceness such as first-class-object functions, tuple-unpackin

          • > - Python's web frameworks are amazingly fast and very powerful.

            Python has a pile of MVC frameworks with 99% overlapping functionality but little else. Show me Python's answer to JSF, Tapestry, or Wicket.
    • Re: (Score:2, Informative)

      ...and it need not be said.

      Between Pyrex [canterbury.ac.nz] and Psyco [sourceforge.net], there's really very, very few applications that a language like Python isn't appropriate for. Premature optimization is the far more common programmer sin these days than choosing a language that's "too slow." Except for a few, specific application domains (that only a minority of coders are writing) dynamic languages like python are an excellent choice on today's hardware. And if you need it to be faster, just profile, find the couple of spots that m

    • Re: (Score:2, Insightful)

      Is a car slow because an airplane is much faster? If you're going to write a ray tracer or a weather simulator, C++ would be a better choice than Python. If you're going to write a server than has to deal with a dozen requests per second, a simple game, a GUI app, a code generator or anything else that will not stress your CPU to its limits, Python is fast enough. And you will win in productivity: no compile/link phase, far less code to write, exceptions instead of crashes when your program fails.

      The key to
    • Somebody was going to say that too.
      • # First, as far as web programming is concerned, the users are always slower than the slowest of all programming languages : they read the text, fill in the forms, etc.

        What matters is how fast responses are once forms are submitted.

        # Second, as Python is used in games to implement AI, so I guess it isn't THAT slow.

        Python is almost always (when used in this circumstance) used to script what happens in game AI, not the AI itself. When Python is used for such coding, performance-critical functions are usually
      • Re:Python is SLOW (Score:5, Informative)

        by kpharmer (452893) on Monday November 06 2006, @03:21PM (#16740199)
        > It is just god-awful slow.

        Really? hmmm, my team runs a huge data warehouse in which all data is transformed via python programs. This means 40+ million rows a day get hash table lookups, business rule validations, type changes and various transformations.

        Then most of that data goes through an additional metadata-driven validation process that checks and confirms every single field. Again, metadata-driven - so a oouple hundred lines of various hash table lookups to determine exactly what validation applied to each field.

        Ok, now let's talk performance:
            1. io performance (most critical factor here)
                      a. same as c, in other words, extremely fast
            2. cpu performance
                      a. much slower than c, but workable
                      b. psycho helps a ton
                      c. the ability to rewrite key functions and classes is cool

        Let's also talk about productivity
            1. great for ease in training part-time or junior programmers
            2. great for immediately understanding old code
            3. great for writing robust test-driven code
            4. good for very quickly assembling a solution

        The above combo of ease of writing, ease of maintaining puts it far ahead of perl, tcl and java. Ruby is really the one other one in this niche I can think of off the top of my head. And even there Python appears stronger on the maintenance side.

        So, yeah - I'm sure there are many applications that have more significant performance requirements than ours does. But for this large application it is completely fine.
      • Even my Ruby code is faster than Python.

        That simple stupidity just made everyone who knows anything about Ruby and Python dismiss your post as utter nutjobbery.

        Java is indeed faster than Python by a large margin (unless the runtimes are short, in which case the sheer monstruosity of the JVM's startup time kills Java's perfs).

        TCL compares very favourably to Python, even though it's mostly slightly slower, unless you're using Regexp (the Tcl regex engine is just wicked fast).

        But Ruby on the other hand,

    • Re: (Score:3, Interesting)

      So, I was going to mod you Troll, but I decided to respond instead, since I think a lot of people are under the same misapprehensions as you are.

      Regarding the indentation-as-syntax, consider the following C code, where someone tried to add the baz() function to a loop:

      while (foo())
      bar();
      baz();


      This code has an obvious bug. Baz() is not in the loop body, because the braces are missing. It's obvious from the indentation that that was the coder's intention. Why does one need an
      • Once you've actually used the python for any period of time you come like this feature. In reality whitespace does matter. When a person reads a block of code, what the person thinks the code does is at least as important if not more important than what the compiler/interpeter builds the code to do. Making whitespace a functional part of the code just aligns the reader and the interpeter/compiler which removes a source of errors.
      • Re: (Score:3, Interesting)

        And I'd been using that for years before I bothered to read the documentation and discovered:

        <pre>print '%(imperative)s, a %(adjective)s %(noun)s!' % {'imperative': 'Look!', 'adjective': 'built-in', 'noun': 'templating system'}</pre>