Greg Ewing wrote:
> One of the arguments being used against automatic
> unicode->char * using ascii as the encoding seems
> to be that it can cause your module to fail at run
> time.
>
> But how is this different from using an explicit
> encoding operation? It can *still* fail at run time
> if the unicode string passed can't be represented
> in the chosen encoding.

I agree that that's not an argument. The main arguments IMHO are that a)
you can't be sure that you are actually looking at an ASCII-compatible
string (i.e. ISO or UTF-8 encoded) and b) this makes it very easy to write
buggy code that works perfectly until someone passes non-ASCII characters.

I find it helpful to prevent writing such code right from the beginning,
rather than requiring manual fixing when the problem comes up. I think
that was one of the main reasons why the types were separated for Py3.

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to