Guido van Rossum wrote: > The only remaining question is what if anything to do with an > encoding argment when the first argument is of type str...)
From what you said earlier about str in 2.x being interpretable as a unicode string which contains only ascii, it seems to me that if you say bytes(s, encoding) where s is a str, then by the presence of the encoding argument you're saying that you want s to be treated as unicode and encoded using the specified encoding. So the result should be the same as bytes(u, encoding) where u is a unicode string containing the same code points as s. This implies that it should be an error if s contains non-ascii characters. This interpretation would satisfy the requirement for a single call signature covering both unicode and str-used-as-ascii-characters, while providing a different call signature (without encoding) for str-used-as-bytes. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.) | [EMAIL PROTECTED] +--------------------------------------+ _______________________________________________ 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