Language Pyrex
Date: | 08/21/07 |
Author: | Ilan Schnell |
URL: | http://ilan.schnell-web.net/ |
Comments: | 1 |
Info: | http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ |
Score: | (4.00 in 1 votes) |
# beer.pyx # # Author: Ilan Schnell # # Invocation: # $ pyrexc beer.pyx # $ gcc -c -fPIC -I/usr/local/include/python2.5 beer.c # $ gcc -shared beer.o -o beer.so # $ python -c "import beer" cdef bob(int n): cdef char *s s = "bottles" if n: if n==1: s = "bottle" return "%s %s of beer" % (n, s) else: return "no more %s of beer" % s for n in xrange(99, 0, -1): print bob(n)+" on the wall, "+bob(n)+"." print "Take one down and pass it around, "+bob(n-1)+" on the wall." print print "No more bottles of beer on the wall, "+bob(0)+"." print "Go to the store and buy some more, "+bob(99)+" on the wall."
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
CeliaPennington28 said on 03/18/10 12:11:23
Every body remembers that men's life seems to be not cheap, but some people need cash for different issues and not every man gets enough money. Hence to receive fast <a href="http://lowest-rate-loans.com/topics/credit-loans">credit loans</a> or just commercial loan should be a right way out.