On 5/16/08, Robert Bradshaw <[EMAIL PROTECTED]> wrote:
> I haven't played with Py3. I was actually (pleasantly) surprised it
>  worked in Py2, but if it's being discontinued then it doesn't help my
>  case. But it does mean that stuff like
>
>  --- a.pyx ---
>
>  def foo(x):
>      if x > 0:
>          return "good"
>      else:
>          return "bad"
>  -------------
>
>  import a
>  print "3 is %s" % a.foo(3)
>
>  won't work in both Py2 and Py3, which I think it should. "Principle
>  of least surprise."
>

Yep, that the reason I noisily complained about this... But still, I
can live with it provided that Cython have a easy, non programatic
way, like a command line flag, to create "abc" literals as unicode.
With easy I mean a command line flag, with non-programatic, I mean I
do not have to use __future__ imports.

Regarding to your example, it will not fail in Py3, but you will get
the following:

>>> print("3 is %s" % b"good")
3 is b'good'
>>>



-- 
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

Reply via email to