On May 16, 2008, at 1:43 PM, Lisandro Dalcin wrote:

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

What it does mean is that you have to ship two separate sets of C  
files, which is why I'm pushing for this specific change to be  
decided at C compile time. To be clear, I think it makes sense for a  
string literal to be a str.

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

OK, that's almost worse (imagine this getting inserted into some  
database rather than being displayed to the user).

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to