[Pyrex] [PATCH] 'include' statements inside 'cdef class' level

Robert Bradshaw robertwb at math.washington.edu
Wed Sep 5 05:55:31 CEST 2007


If you want to include the same pxi file in multiple classes, that  
will lead to redundant code that could possibly be implemented  
otherwise, and if it is included into only one class I'm not seeing  
the benifit (and it may make things much more difficult to follow-- 
I've had some not-so-pleasant experiences trying to understand code  
from include-happy C developers). You clearly have reason in mind for  
wanting this patch, could you please elaborate? Would being able to  
cimport module-level cdef functions solve the problem as well?

I'm also curious, Greg, what was your reasoning to make this explicit  
restriction in the first place (though it does seem natural to me).  
And, if we allow imports inside cdef'd classes, what about inside non- 
cdef'd classes, or inside functions, or anywhere else?

-Robert


On Sep 4, 2007, at 5:50 AM, Caio Marcelo wrote:

> On 9/3/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>> What exactly does "correct" mean here? Do you mean
>> that the contents of the included file start at an
>> indentation of zero, or at the same level as the
>> including code?
>
> Thinking about it, both ways are reasonable (i.e. indenting or not the
> included file). In both cases it will solve my problems, and I  
> agree that
> not indenting the included file may have better semantics: "it will  
> include
> the content of the other file in the level that the included  
> statement is",
> plain and simple. Actually, it would make the change even simpler: the
> if-statement (the one that calls s2.expect_indent()) would not be  
> necessary.
>
>
> Cheers,
>   Caio Marcelo
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex




More information about the Pyrex mailing list