[Patches] fileinput.py argument handling (and suggestion)
Guido van Rossum
guido@python.org
Mon, 10 Apr 2000 15:27:45 -0400
> Well, that's one. Is anyone else interested in seeing a super-beefed up
> (possibly over-engineered) "read a `text' file with some subset of the
> usual Unix conventions" class added to fileinput.py?
To me, text_file.py really works at a higher level than fileinput.py.
It deals with lexical analysis issues: comments, line continuations,
whitespace stripping. But it isn't very configurable: it has fixed
notions of what's a continuation line, what's a comment, and so on,
and you can only define a simple "profile" of options.
For another approach, see Eric Raymond's shlex.py, which is a standard
module since Python 1.5.2. It deals with splitting into tokens and
handling quotes -- again, using rather fixed rules, although you can
change what's a quote and what's in a word (a step up from
text_file.py).
Together with ConfigParser.py, I think we've got a rather eclectic and
haphazard set of modules. Before we standardize on any particular
one, we should analyze the needs of our users more!
--Guido van Rossum (home page: http://www.python.org/~guido/)