Request for comments: Search and replace script
VanL
vlindberg at verio.net
Fri Feb 22 19:33:51 EST 2002
Hello, and thanks for looking.
> tabs, ick, tabs .....
Fixed. Everything now uses 4 spaces instead.
> please try to keep a line down to 78 chars
Fixed, at least for most of the code. I don't know how to deal with
long strings, tho:
For example, self.writeLog('This is a very long line that has this %s
substitution and will go longer than 78 chars")
> exiting in a constructor is not nice, especially when you are
planning on having
> others use your code. Just throw an exception.
Fixed. I only saw that in the FileChecker. If I did that anywhere
else, please hit me upside the head.
> check() makes some of the same checks over and over, perhaps you
should look at
> the code's flow here and see if it can be done differently
I am not sure what you mean here. What I tried to do was to define each
separate check (binary, openable, etc) in its own function and then have
one function that would call them all in the correct order. Is this not
the best way to do it?
> globals are also icky
I agree, but I wasn't sure how to have different classes accessing the
same variable without having the variable be global. Is there another
way to do it?
> why is usage a) a list (it could have been a tuple) and b) defined at
all. You
> could just read __doc__ and make it the file's doc string
usage was originally the doc string. It was so long, however, that I
broke it up so that only an appoximate screenful would appear at a time.
Sort of a poor man's 'more' for when this is run on a windows system.
As for why it is a list, no particular reason. I just happened to give
it square brackets instead of parenthesis.
Thanks,
Van
More information about the Python-list
mailing list