Lisandro Dalcin, 25.10.2009 17:04:
> So you could support the "lhs = rhs[slice]" when lhs is a
> pyobject, but generate a Cython compile error if lhs is a C
> pointer/array type (perhaps making exceptions for the case of
> char[]/char*) until auto mem alloc is implemented.
Yes, that occurred to me, too, after sending the e-mail. So it's actually a
special case that should be easier to implement for the beginning, without
preventing the general feature from becoming available later on.
(preferably after implementing the SIMD type, so that we can see what's
actually left to add).
I really like how the slicing syntax fixes the "C string potentially
containing \0 -> Py string" conversion, BTW. We could even support this
efficiently then:
cdef char* s = "some encoded C string"
unicode_string = s[:1531].decode('UTF-8')
That would become a straight call to PyUnicode_DecodeUTF8(s,1531,NULL).
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev