A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-September/017568.html below:

[Python-Dev] Parametrized codecs

[Python-Dev] Parametrized codecsAndrew Kuchling akuchlin@mems-exchange.org
Wed, 19 Sep 2001 14:01:55 -0400
>The codec design allows extending the constructors using keyword
>arguments, however I'd rather not add a generic **kws argument
>to the base classes since this would hide errors (unknown or
>unsupported keywords, mispellings, etc.).

Isn't such an argument required at least for StreamReaderWriter,
because it actually instantiates two objects?

class StreamReaderWriter:
    def __init__(self, stream, Reader, Writer, errors='strict'):

        """ ...
            Reader, Writer must be factory functions or classes
            providing the StreamReader, StreamWriter interface resp.
        """
        self.stream = stream
        self.reader = Reader(stream, errors)
        self.writer = Writer(stream, errors)

Hmm... you'd better not need to have two different set of keyword
arguments for Reader and Writer.  Is that limitation acceptable?  If
it is, then the list of changes becomes 1) add **kw to codecs.open,
and 2) add **kw to StreamReaderWriter's constructor, and apply it to
the Reader() and Writer() calls.

>The encoder and decoder functions must work stateless.

OK, then they're not suitable for encryption (in general, though
they'd work fine for ECB mode).

--amk



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4