On 5/15/08, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > * Iff 'from __future__ import unicode_literals' is NOT issued, then at > > compile time, Cython should create strings as is the default in the > > compile-time Python version, that is, (byte) 'str' type as in Py2, or > > (unicode) 'str' type as in Py3. > > This contradicts what you said above. If you want source compatibility, you > can't change the semantics based on the compile time environment - except for > the cases where the runtime environments really differ (such as byte/unicode > identifiers). Imagine you had some latin-1 encoded XML byte literal in your > code. In Py2, under your proposal, this would become a byte string that can > be > parsed. In Py3, however, this would suddenly become a unicode string and the > parser would refuse to handle it, as it's no longer ISO encoded. >
Well, depite being a Spanish speaker, my mind still lives in the ASCII world. I was actually thinking about string literals with pure-ascii characters. My intention is just if I write this in a 'pyx' file meth = "__call__" if hasattr(someobj, meth): do_something(...) then this code should work as expected in Py2.X and Py3. Does this make sense? -- 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
