ANN: Pyrex 0.4.3

Skip Montanaro skip at pobox.com
Tue Aug 27 10:54:51 EDT 2002


    Matthias> What's the reason of introducing a new language construct
    Matthias> instead of transforming the old one into a pure C loop
    Matthias> wherever possible?

Because Python is highly dynamic:

    >>> def myrange(x,y=None,z=None):
    ...   return [4.0]
    ... 
    >>> import __builtin__
    >>> __builtin__.range = myrange
    >>> for i in range(12):
    ...   print i
    ... 
    4.0

When compiling, you can't assume anything about the input parameters or
return value of range().  You need a new construct which says, "this is how
to enumerate the integers between x and y."

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html




More information about the Python-list mailing list