[Python-Dev] Codecs and StreamCodecs

Fredrik Lundh fredrik@pythonware.com
Fri, 19 Nov 1999 14:33:50 +0100


Andy Robinson <captainrobbo@yahoo.com> wrote:
> So I would take flush() to mean 'shift back to
> ASCII now'.

if we're still talking about my "just one
codec, please" proposal, that's exactly
what encoder.flush should do.

while decoder.flush should raise an ex-
ception if you're still in double byte mode
(at least if running in 'strict' mode).

> Calling flush and reopen would thus "almost" get the
> same data across.
> 
> I'm trying to think if it would be dangerous.  Do web
> and ftp servers often call flush() in the middle of
> transmitting a block of text?

again, if we're talking about my proposal,
these flush methods are only called by the
string or stream wrappers, never by the
applications.  see the original post for de-
tails.

</F>