File-like filter pattern?

Erik Max Francis max at alcyone.com
Thu Dec 19 04:01:54 EST 2002


Fredrik Lundh wrote:

> in addition to the file protocol, the (reset)/feed/close protocol used
> by sgmllib/xmllib and most XML parsers is pretty common.  and about
> as simple as anything can be.

Indeed.  Really the crux of my question was:  Given a file-like object,
is there already a well-known convention or pattern for hooking the
output of one to the input of another in a potential arbitrary chain?

Examples like gzip.GzipFile take the "sink" file-like object in the
constructor, but in my case I'd prefer to defer the "linking" until
later (and perhaps support dynamic attaching and detatching of filters
to one another).

It's looking like the answer is, "There really isn't any well-known,
recognizeable convention," which is fine; I just wanted to make sure
there wasn't some well-known pattern that I was missing.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ When you love somebody, you're always in trouble.
\__/ Col. Sherman Potter
    REALpolitik / http://www.realpolitik.com/
 Get your own customized newsfeed online in realtime ... for free!



More information about the Python-list mailing list