Python has a wonderful interactive interpreter (i.e. shell). IPython is a third-party Python shell that's even nicer, but that's a topic for another post. It's fairly common to code in the shell until you have the code working correctly, and then copy-and-paste it into your program. Developing super-interactively is a great way to keep bugs at bay.
However, sometimes you need more setup before you can start coding. For instance, when writing a Web app in, say Pylons, you might need an actual request and a database connection before you can start coding what you want. You might even need a form POST before you can start. Ideally, you'd be able to start the shell from in the middle of your application at just the right spot. I'm pretty sure that someone out there knows how to get IPython to do the right thing, but I find using pdb, the Python debugger, really helpful for this purpose.
First of all, add the following wherever you want to break into the debugger, "import pdb; pdb.set_trace()". If you need some more help about the debugger itself, type "?". Now, you'll want to see what variables you have to play with, so use "dir()". Let's say the "request.environ" object has what you want, but you're not sure under what key. Well, start by printing it, "p request.environ". If you need a nicer looking version, try "from pprint import pprint; pprint(request.environ)". If you find the right key, say 'spam', then print that, "pprint(request.environ['spam'])". Maybe spam is an object, and you need to know what methods it has, "pprint(dir(request.environ['spam']))".
In the Python shell, you can use "help(x)" to find out more about x if x is a module, class, or function. If x is an object, try "help(x.__class__)". In the debugger, help() tends to not work for a reason that someone smarter than me probably understands. However, you can still do things like "p x.__class__.__doc__".
The debugger isn't very good for writing new functions or multi-line statements, but it's great for evaluating simple expressions. Once you have the code you want, you can copy-and-paste it back into your program and repeat the process. Writing code in this way is really helpful so that you can deal with the details one at a time without trying to debug a larger program that might have more than one bug. That's not to say I don't make heavy use of print-statement debugging, but using pdb is great if you want to "look around."