Greg Ewing wrote:
There's nothing wrong with that, but what it doesn't
answer is why it's not sufficient just to do things
like
from gzip import gzip_codec
stream2 = BytesTransform(gzip_codec, stream1)
i.e. why there has to be a special kind of namespace
for codecs.
Selecting an encoding is the kind of thing that will often come from the
application's environment, or user preferences or configuration options,
rather than being hardcoded at development time. With a flat,
string-based codec namespace, those things are trivial to look up.
Having to mess around with __import__ just to support a "choose
compression method" configuration option would be fairly annoying.
The case for the special namespace is much stronger for the actual
unicode encodings, but it still has at least some force for the
bytes->bytes and str->str transforms.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com