[Pyrex] ANN: Pyrex 0.9.7
    Stefan Behnel 
    stefan_ml at behnel.de
       
    Sat May 10 14:34:43 CEST 2008
    
    
  
Hi,
Brian Blais wrote:
> In python, I am used to syntax:
> 
> for var in stuff:
> 
> where my eye finds "var" and then "stuff", so I first find out the
> relevant variable, and then the values it will take.
> 
> in old pyrex syntax,
> 
> for var in begin<= var < end:
> 
> my eye finds "var" and then "begin" and "end", so I first find out the
> relevant variable, and then the values it will take.
Actually, in the old Pyrex syntax, it was
   for var *from* begin <= var < end:
but since now we have
>  for begin <= var < end:
would it be that bad to always use
    for var in ...
instead and just distinguish between
    for var in something:
and
    for var in begin <= var < end:
?
Then again, there even is a switch in Cython that allows you to convert
    for var in range(begin, end):
to
    for var in begin <= var < end:
so maybe the whole discussion is somewhat pointless anyway. I don't quite see
why we shouldn't just always convert
    for var in range(begin, end):
to
    for var in begin <= var < end:
*iff* var is cdef-ed as a C integer type. According to Robert, there's a
difference if the loop overflows, but that case is almost certainly a
programming error when var is a C type, and there is no such thing as Python
compatibility for C variables anyway.
Opinions?
Stefan
    
    
More information about the Pyrex
mailing list