Choosing a new name for compilerlike.py (was: [Python-Dev] Re: [Python-checkins] CVS ...)

Peter Funk pf@artcom-gmbh.de
Mon, 20 Aug 2001 19:28:21 +0200 (CEST)


Hi,

> >>>>> "ESR" == Eric S Raymond <esr@users.sourceforge.net> writes:
> 
>   ESR> --- NEW FILE: compilerlike.py ---
>   ESR> """ compilerlike -- framework code for building compiler-like
>   ESR> programs.
> 
>   ESR> There is a common `compiler-like' pattern in Unix scripts which
>   ESR> is useful for translation utilities of all sorts.  A program
>   ESR> following this pattern behaves as a filter when no argument
>   ESR> files are specified on the command line, but otherwise
>   ESR> transforms each file individually into a corresponding output
>   ESR> file.

Jeremy Hylton wrote:
> I think the name of this module is confusing as best.  

I agree with Jeremy.

> It doesn't have
> anything to do with compilation -- and the pattern you describe
> doesn't apply to compilers I'm familiar with (e.g. gcc).  This library
> may be useful, but it needs a better name and short description to
> help people understand its use.
> 
> I think there was a suggestion to integrate this code with fileinput,
> which seems to make sense.  fileinput seems to describe what this
> module does -- deal with files as input.

Yes, this makes some sense.  On the other hand the main purpose of this
module seems to be to get Unix convention to use a hyphen as alias-name 
for 'stdin' and 'stdout' factored out into a standard module. 

What about calling this 'FilterFrameWork.py'?  

I had quick glance into this module and I think this needs some more
thoughts.  Using filecmp.cmp each time to find out, whether the
provided callback function has done something to the data looks costly 
and is not very generic.

Much of the framework functionality has to do with command line
argument processing, which is often coupled with option processing
(fancygetopt jumps into my mind here) and in many similar scripts
if have seen or written myself often these commands provide the
(additional) possibility to specify either input or output or both
using option arguments.
For example:
	foobar --input=baz.in --output=baz.out
    or 
        foobar -i baz.in -o baz.out

So IMO this module is not yet ready for the Python standard library.

Regards, Peter
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)