[I18n-sig] Codecs

Paul Prescod paul@prescod.net
Sun, 04 Jun 2000 09:54:01 -0500


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