[Pyrex] Pyrex optimization chitchat

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Jan 22 02:27:35 CET 2004


Paul Prescod:

> cdef x(list foo):
> 	foo.append(5)
> 
> Should the compiler expand that to optimized PyList_Append code or call 
> a method by name?

I think it really has to do a method lookup. Even if foo is
declared to be a list, it might be a subclass of list that
overrides the append method.

It might be worth having some special Pyrex builtins such
as listappend for things like this.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list