Lisandro Dalcin, 05.07.2010 18:11:
> On 5 July 2010 12:34, Stefan Behnel<[email protected]>  wrote:
>> Lisandro Dalcin, 05.07.2010 17:15:
>>> On 5 July 2010 11:32, Stefan Behnel wrote:
>>>> Py2.7 final gives me this:
>>>>
>>>>       Python 2.7 (r27:82500, Jul  5 2010, 13:37:06)
>>>>       [GCC 4.4.3] on linux2
>>>>       Type "help", "copyright", "credits" or "license" for more 
>>>> information.
>>>>
>>>>       >>>    {i for i in range(10)}; i
>>>>       set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>>>       Traceback (most recent call last):
>>>>        File "<stdin>", line 1, in<module>
>>>>       NameError: name 'i' is not defined
>>>>
>>>>       >>>    {i:i for i in range(10)}; i
>>>>       {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
>>>>       Traceback (most recent call last):
>>>>         File "<stdin>", line 1, in<module>
>>>>       NameError: name 'i' is not defined
>>>>
>>>> List comprehensions have not changed:
>>>>
>>>>       >>>    [i for i in range(10)]; i
>>>>       [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>>       9
>>>>
>>>> I know, I have asked this more than once already, but I think this is
>>>> finally enough of a reason to fix the current behaviour also in Cython.
>>>
>>> No objections from my side. However, perhaps you would like to
>>> consider a compiler directive to enable this annoying thing? Ideally,
>>> by default, it should be enabled on *.py files and disabled on *.pyx
>>> files.
>>
>> What purpose would that serve? I think it's one way or the other. (And my
>> preference should be clear by now.)
>
> Just backward compatibility, in case Cython is asked to handle *.py files.
>
>>
>>> PS: We have to start in making Cython target Python 3, and provide
>>> support for Python 2 features on-demand, let say by using a compiler
>>> directive #python2: enable-something=True,use-this-semantics=True
>>
>> There are "-2" and "-3" options at the command line and a "language_level"
>> directive at the source level now.
>>
>
> OK. Good to know we have -2/-3. Then, what are you going to do under
> -2 for list comprehensions?

Oh, list comprehensions won't change (unless compiling with -3), thus 
keeping the same quirky state that they have in Py2.x. Only set/dict 
comprehensions will change, following Py2.7, so that list comprehensions 
are the *only* remaining quirk here when compiling Py2 code.

The -3 behaviour is already implemented anyway.

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

Reply via email to