r/Python • • Feb 28 '13

What's the one code snippet/python trick/etc did you wish you knew when you learned python?

I think this is cool:

import this

259 Upvotes

307 comments sorted by

View all comments

Show parent comments

7

u/[deleted] Feb 28 '13

Different use cases. I would use pydev to write a program, but IPython is very good for interactive sessions. Examples of where IPython is useful:

  • Any time you run a script using %run(), all the variables and methods of that script get dumped into the local namespace.

  • You can reference output and input by line. For instance you can edit the last five lines of input in an editor.

  • Tab completion and very simple access to all local variables.

  • History across sessions.

  • IPython notebook is also cool probably, but I don't use it.

1

u/westurner Mar 06 '13 edited Mar 08 '13
  • memory usage

  • startup time

  • CLI support

  • %timeit

  • ipdb