ANN: Pyrex 0.4.3

Terry Reedy tjreedy at udel.edu
Tue Aug 27 21:54:12 CEST 2002


"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.1030460145.28063.python-list at python.org...
>
>     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."

I would rather that Pyrex make that assumption --  that I have not
done anything so crazy (rare) as to replace a builtin -- and maybe
give me an option to declare that I have if I have.  Similarly for
len() and other builtins.

Terry J. Reedy






More information about the Python-list mailing list