Pythonification of the asterisk-based collection packing/unpacking syntax

Roy Smith roy at panix.com
Sun Dec 18 08:58:28 EST 2011


In article <mailman.3787.1324197792.27778.python-list at python.org>,
 Chris Angelico <rosuav at gmail.com> wrote:

> > Never underestimate the power of Python's introspection tools, especially
> > the two simplest ones: print and type. Often you will learn more in 10
> > minutes experimentation than in an hour googling.
> 
> +1 QOTW. I refer to this as "IIDPIO debugging" (Eyed Pio) - If In
> Doubt, Print It Out.

I always knew it by the name "Ask the computer".  As in, "WTF is foo?  
Let's ask the computer!".

In addition to print and type, I'm a big fan of dir().  Often, I know an 
object has a method to do what I want, but I can't remember the name.  
For example, the other day, I was using a set (which I don't use very 
often).  I needed the method to remove an item from the set.  Faster 
than finding the right place in the docs, I just fired up an interpreter 
and typed dir(set()) at it.



More information about the Python-list mailing list