comparing Unicode and string

Leo Kislov Leo.Kislov at gmail.com
Fri Oct 20 11:42:16 CEST 2006


luc.saffre at gmail.com wrote:
> Thanks, John and Neil, for your explanations.
>
> Still I find it rather difficult to explain to a Python beginner why
> this error occurs.
>
> Suggestion: shouldn't an error raise already when I try to assign s2? A
> normal string should never be allowed to contain characters that are
> not codable using the system encoding. This test could be made at
> compile time and would render Python more didadic.

This is impossible because of backward compatibility, your suggestion
will break a lot of existing programs. The change is planned to happen
in python 3.0 where it's ok to break backward compatibility if needed.

  -- Leo.




More information about the Python-list mailing list