On Sat, Oct 10, 2009 at 12:15 PM, Stefan Behnel <[email protected]> wrote: > Hi, > > I implemented the string CEP 108. > > http://wiki.cython.org/enhancements/stringliterals >
Great! > According to the tests, it looks good so far. I'll push the final fixes to > cython-devel as soon as it's back online. > > One thing I changed was that you can assign a str literal to both char* and > bytes, i.e. > > cdef char* s = "abc" > cdef bytes b = "abc" > > will both work. I think that makes sense, given that char* and bytes are > mostly equivalent otherwise. Mmm... Perhaps you could start by requiring an explicit 'b' prefix? cdef bytes a = b"xyz" # OK cdef bytes b = "xyz" # ERROR We can relax this later (or just ignore this comment) if this restriction does not make sense... > This only regards compile-time coerced > literals, so you still cannot assign > > cdef str s = "abc" > cdef bytes b = s # ERROR! > That would be an error at Cython compile-time, right? In such case, of course +1. > which depends on runtime semantics. Also, > > cdef unicode u = "abc" # ERROR! > > is prohibited. You must use a unicode literal here. > Fine, does make sense. Explicit is better than implicit (that's the reason I've asked for an explicit 'b' prefix when the target type is 'bytes'). > Any comments on this change? > > Stefan > How things will work in the case of "from __future__ import unicode_literals" ?? (I cannot currently access the CEP, perhaps the answer is there, in such case do not waste your time explaining it here.) > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
