Does Python really follow its philosophy of "Readability counts"?
alex23
wuwei23 at gmail.com
Thu Jan 15 02:15:18 EST 2009
On Jan 15, 1:06 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> I just looked up Cython and see that it's based on Pyrex. Worth
> knowing about, I guess; but basically I think C is evil.
I feel much the same way, but the recent modifications to Cython that
provide a "pure Python"[1] approach mean that you can minimise the
amount of C you need to write and still take advantage of features
like static types:
@cython.locals(s=cython.double, i=int, n=int)
def harmonic_sum(n):
s = 0
for i in range(1, n+1):
s += 1.0 / i
return s
The same code will both run in Python and compile via Cython. (I'm
surprised the new "pure" approach isn't more clearly promoted on the
site.)
1: http://wiki.cython.org/pure
More information about the Python-list
mailing list