On Sat, Oct 10, 2009 at 1:11 PM, Stefan Behnel <[email protected]> wrote:
>
> It's not that it doesn't make sense, it's rather a case that (IMHO) has an
> equilibrium of pros and cons. For example, you can do
>
> cdef char* c = "abc"
> cdef bytes b1 = c
> cdef bytes b2 = <char*>"abc"
>
> but you can't do
>
> cdef bytes b = "abc"
>
> It's easy to argue that the latter is a Python literal, sure, and that
> makes me +0 for denying it.
Yes, it is a Py string literal, but what KIND of string literal? We
have three kinds of litelals: b"abc", a bare "abc", and u"abc" ...
> Also because
>
> s = "abc"
>
> will actually give you a str object.
>
That's the behavior that I always advocated: an unprefixed literal
will get the "default" Python-level 'str' type in both Py2/Py3 ...
However, if the user uses explicit 'bytes' or 'unicode' types, then I
assume she knows what she is doing and has a reason to make such
explicit typing, and then she should not be bothered to explicitly
specify the KIND ('b' or 'u') of the literal...
Please note that this is just FUD from my side and I'm not sure at all
that if such strictness is actually a good idea...
--
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