STINNER Victor <[email protected]> added the comment:
> I think it may even make sense to build the filtering
> options into codecs.lookup() itself:
>
> def lookup(encoding, decoded_format=None, encoded_format=None):
> info = _lookup(encoding) # The existing codec lookup algorithm
> if ((decoded_format is not None and decoded_format !=
> info.decoded_format) or
> (encoded_format is not None and encoded_format !=
> info.encoded_format)):
> raise CodecLookupError(info, decoded_format, encoded_format)
lookup('rot13') should fail with a lookup error to keep backward
compatibility. You can just change the default values to:
def lookup(encoding, decoded_format='text', encoded_format='binary'): ...
If you patch lookup, what about the following functions?
- getencoder()
- getdecoder()
- getincrementalencoder()
- getincrementaldecoder()
- getread()
- getwriter()
- itereencode()
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7475>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com