[Cython] Visitor patterns and Python 2.4

Robert Bradshaw robertwb at math.washington.edu
Wed May 7 00:21:25 CEST 2008


On May 2, 2008, at 10:56 PM, Stefan Behnel wrote:

> Hi,
>
> Dag Sverre Seljebotn wrote:
>> Are there any real reasons for leaving the Cython compiler (not  
>> talking
>> about generated or supported code of course) at Python 2.3, rather  
>> than
>> a small bump to 2.4? Reason: I'd like decorators.
>>
>> The rationale: Notice that parse tree visitors can currently be  
>> written
>> like this:
>>
>> class AnalyseControlFlow(VisitorTransform):
>>     def pre_FuncDefNode(self, node):
>>         node.body.analyse_control_flow(node.scope)
>>         return False # do not recurse beyond first function level
>
> If this way of doing it is accepted, I'm actually for accepting 2.4  
> code. I
> don't know any important platform that doesn't come with at least  
> Py2.4. And
> note that most people won't even need to run Cython themselves,  
> even if they
> use software implemented in Cython.

We ship our own Python (2.5.2) with Sage, but I would rather stick  
with 2.3 compatibility. You might not consider it "important" but my  
computer (OS X 10.4, yet I know 10.5 is out but I haven't found the  
time to upgrade yet) has 2.3 by default, as did OS X 10.3.

I very much dislike using __class__.__name__ to decide what functions  
to call, but it doesn't look like you need decorators to get around  
this, do you?

- Robert







More information about the Cython-dev mailing list