On Fri, 2 Jun 2000, Peter Funk wrote:
I agree: this is really ugly. Since doc-strings are something special, I don't think, we should travel further down this road. I believe, we should use a special doc-string extration-tool (possibly build on top of ping's 'inspect.py'?), which will then create a .pot-file solely out of __doc__-strings.
Getting __doc__ strings is pretty easy (inspect.py is one possibility). But presumably we want to get all the strings, don't we? That should be trivial with tokenize, right? ---- getstrings.py ----- import sys, tokenize strings = [] def tokeneater(type, token, start, end, line): if type == tokenize.STRING: strings.append(eval(token)) file = open(sys.argv[1]) tokenize.tokenize(file.readline, tokeneater) print strings ------------------------ % ./getstrings.py /usr/local/lib/python1.5/calendar.py ['calendar.error', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun', '', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'No vember', 'December', ' ', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'bad month number', ' ', ' ', '', '', ' ', ' ', '\012', '\012', '\012', ' ', '', '', ' '] Am i missing something? -- ?!ng