Pythonification of the asterisk-based collection packing/unpacking syntax

Chris Angelico rosuav at gmail.com
Sun Dec 18 09:06:34 EST 2011


On Mon, Dec 19, 2011 at 12:58 AM, Roy Smith <roy at panix.com> wrote:
> 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.

That's excellent when all you need is the name. I usually have IDLE
running (all the time - which sometimes produces oddities after I
experiment with monkey-patching some module or other, and then oddly
enough, things don't work properly!!), and will snap off "help(foo)"
for any foo. Unfortunately help() is at times unhelpful, and even at
its best it's very spammy. There's no one best solution; the
successful programmer will usually have a large toolset at his
disposal.

ChrisA



More information about the Python-list mailing list