How useful do you find the interactive interpreter?

Paul Sidorsky paulsid at home.com
Sat Jun 23 22:21:28 EDT 2001


slaytanic killer wrote:

> I am looking at Python seriously, and I can see that the interpreter
> would be really good for testing out ideas.  Getting small things to
> work and then switching over to a text editor to generalize what I've
> learned.  Is this how people generally use it?  Or is it an even
> deeper part of coding?

I'm still learning the finer points of Python, and I've found myself
using the interactive interpreter a lot more frequently in recent days. 
It's really handy for getting answers that might be hard to find in the
documentation, or when it's just faster to try it rather than look it
up.  I've also started to use it for experimentation.

The biggest problem is that, coming from C/C++ as I am, I have to keep
remembering that I do actually have the benefit of an interpreter now! 
It's a real easy thing to forget about when you're used to looking up
stuff and writing test programs by default.  Doing stuff interactively
in the interpreter takes me back to my days of doing BASIC in grade
school, except this time the language is much nicer.  :-)

Things I recently did in interactive sessions:

- Checked to make sure an empty list evaluated to false.
- Checked to see what the __dict__ attribute looked like on classes vs.
objects.
- Experimented with some of the more advanced features of regular
expressions.
- Profiled the hash() function to see if hashing a string was
faster/slower than hashing an integer.

All of this stuff would have taken a lot longer to either look up in the
docs or write test programs for, so I'm very glad the interactive mode
was there!

-- 
======================================================================
Paul Sidorsky                                          Calgary, Canada
paulsid at home.com                      http://members.home.net/paulsid/




More information about the Python-list mailing list