Lisandro Dalcin, 17.02.2010 14:20:
> On 17 February 2010 04:06, Stefan Behnel wrote:
>>> On Feb 16, 2010, at 1:08 PM, Lisandro Dalcin wrote:
>>>> +try:
>>>> + set
>>>> +except NameError:
>>>> + # Python 2.3
>>>> + from sets import Set as set
>> This shadows the 'set' builtin, though, so Cython can't optimise it. That
>> may not be important in this case, but given that Cython "implements" the
>> set type for 2.3 anyway, would it make sense to provide the 'set' builtin
>> in Shadow.py and reimport it from there instead?
>
> Stefan, I general I do not like the idea loosing a any optimization in
> ALL Python versions just for providing compat for the old Py2.3.
That's exactly what this is meant to prevent.
> Could you elaborate a bit more what should be done to make it work
> using Shadow.py ? I mean, adding 'set' to Shadow.py is trivial, but I
> do not get how to use it in Parsing.py...
You'd do
from cython import set
in Parsing.py. Cython would then consider that the true 'set' builtin at
compile time, regardless of the Python environment, whereas an uncompiled
Cython would simply let Python import 'set' from Cython's Shadow module and
be happy.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev