mckryall wrote:Say you have a list. It is a list of characters/numbers. You have to do things to this list, things where both the nature and the number of depend on the list. You could create an if statement with nature * number possibilities, or you could create a string and use operators such as "'str' * num" and algorithms similar to "str = 'DoStuff(%d,%d,%s)' % (num1, num2, str)"
Ok, I guess it might be useful in cases like that, although I never had need for anything like that, and I've been programming for quite some time...
The only time I can think of possibly needing something like that would be when testing stuff, but that's better done in the interactive prompt.
If you have a more specific example, I'd like to hear about it.
mckryall wrote:Also, it's useful, when testing code and trying to figure out the best way to interact with something, to emulate the interpreter at the end and try a few different methods, without leaving the original Python instance.
more useful for stuff like that.