Ron Adam <[EMAIL PROTECTED]> wrote:
> Why was it decided that the unicode encoding argument should be ignored 
> if the first argument is a string?  Wouldn't an exception be better 
> rather than give the impression it does something when it doesn't?

>From the PEP:

    There is no sane meaning that the encoding can have in that
    case.  str objects *are* byte arrays and they know nothing about
    the encoding of character data they contain.  We need to assume
    that the programmer has provided str object that already uses
    the desired encoding.

Raising an exception would be a valid option.  However, passing the
string through unchanged makes the transition from str to bytes
easier.

  Neil

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to