ANN: Pyrex 0.4.3

Magnus Lie Hetland mlh at
Wed Aug 28 03:40:38 CEST 2002

In article <mailman.1030496322.32078.python-list at>, Skip
Montanaro wrote:
>    François> But Pyrex already invites authors to do this, by establishing
>    François> contracts.  When I tell Pyrex `cdef char *text', I guarantee
>    François> my intent about `text', and Pyrex fills its share by producing
>    François> fast access or usage to that variable.  
>I agree, however with
>    cdef char *text
>you are stating something about the current module.  You are saying to
>callers, "mymodule.text is a string".  In contrast, stating something like
>    cdef int __builtin__.range(int, int, int)
>tries to force your notion of the range() builtin's prototype on other
>modules in the application, many of which may be out of your control.

But you don't have to use __builtin__.range? You could declare a local
optimized version... Something like

  cdef optimized range

or whatever.

>    François> I'm quite ready to declare that `range' and `len' have their
>    François> usual meaning.  If I am not ready to this, I just will not.
>What happens if you are ready to declare this but the author of module A
>isn't? ;-)

I still don't see the problem. If I do

def range(*args): pass

in my module, that doesn't affect other modules. Why should this cdef
declaration have to?


Magnus Lie Hetland                                  The Anygui Project                        

More information about the Python-list mailing list