Brian Takashi Hooper
Mon, 05 Jun 2000 00:05:48 +0900
This issue came up before on this list, I think Andy Robinson suggested
it before in the midst of a lot of other Unicode musings. One thing I
remember Andy mentioned was that a codec object could then additionally
contain methods in addition to those required by the codec API, for
example a method to fix broken legacy encoding input strings, etc.
Personally, I would be happier to get an object back from
codecs.lookup(), one vote in favor if it matters.
Are there any good reasons to prefer getting a tuple back from codecs.lookup()?
On Sun, 04 Jun 2000 09:54:01 -0500
Paul Prescod <email@example.com> wrote:
> Should codecs be returned to the user as objects instead of tuples?
> Today we have:
> (UTF8_encode, UTF8_decode,
> UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8')
> output = UTF8_streamwriter( open( '/tmp/output', 'wb') )
> I think this would be a little simpler:
> output=codecs.lookup('UTF-8').stream_writer( open( '/tmp/output', 'wb')
> The object solution is more extensible, requires less "bogus"
> assignments and does not require the user to remember the order of the
> return values.
> Paul Prescod - ISOGEN Consulting Engineer speaking for himself
> Simplicity does not precede complexity, but follows it.
> - http://www.cs.yale.edu/~perlis-alan/quotes.html
> I18n-sig mailing list