codefile 641 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. cdef extern from "stdio.h":
  2. int puts(char *s)
  3. cdef extern from "cfuncs.h":
  4. void some_c_function()
  5. import os
  6. cdef int c_var = 12
  7. python_var = 13
  8. def spam(a=0):
  9. cdef:
  10. int b, c
  11. b = c = d = 0
  12. b = 1
  13. c = 2
  14. int(10)
  15. puts("spam")
  16. os.path.join("foo", "bar")
  17. some_c_function()
  18. cpdef eggs():
  19. pass
  20. cdef ham():
  21. pass
  22. cdef class SomeClass(object):
  23. def spam(self):
  24. pass
  25. def outer():
  26. cdef object a = "an object"
  27. def inner():
  28. b = 2
  29. # access closed over variables
  30. print a, b
  31. return inner
  32. outer()()
  33. spam()
  34. print "bye!"
  35. def use_ham():
  36. ham()