Hi,

Lisandro Dalcin wrote:
> Well, at this point I'm a bit confused... The unicode stuff is the
> weakest point in my knowledge of Python internals...

:) that's just because Unicode is not exactly trivial - especially if you have
to start thinking about bytes at some point.


> Anyway, I will not be able to work on this in the next two weeks, so
> if anyone wants to go on and give a try, just start applying the patch
> to 'cython-devel-py3' repo (I'm not concerned at all about credits for
> the original patch ;-) ) in order this does not stagnate.

done.


> At any
> point, I can contribute testing against my project, just ask me for
> help.

some test cases would be greatly appreciated. :)


> Finally, IMHO Cython pyx-level and generated C-level code should work
> with any Python version.

But your code shouldn't change semantics when you change the runtime
environment. Otherwise it would become completely impossible to write portable
code.


> So, if in a pyx file I wrote "abc", then, by
> default, it should be a ascii string for Py2 and a unicode one for
> Py3.

Not quite right. If you did that in a .py file, that would be the case. If you
do that in Cython, a literal must not change its type, because it compiles to C.


> And Cython should grow a new special 'char' type (like it has for
> bint) to specify ascii string.

Why is that? Two things: what's special about an ASCII string compared to a
byte string in general? And: why aren't "bytes" and "bytearray" enough?


> Then, at the C-level, and depending on
> Python major version, the proper conversion py->c or c->py can be
> managed. If not, wrapping legacy C libs and targeting Py2 and Py3 is
> going to be a nightmare.

It's a nightmare if your code changes behaviour. I think there should be a
command line switch "-3" for compiling plain Py3 code at some point (as
opposed to normal Py2 code) or maybe that should be determined by the runtime
environment of the *compiler*, but the Cython language itself should stay
compatible to Py2.6 for now.

Stefan

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

Reply via email to