Message75515
http://docs.python.org/dev/3.0/library/ctypes.html#callback-functions
ctypes.xFUNCTYPE are another opportunity to advertise decorators.
Please consider inserting yet another qsort example written as a
decorator, perhaps as follows. Or---it could be that I'm slow and the
average pythonista will figure this out on first read.
@CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))
def py_cmp_func(*args):
(a,b,) = (t[0] for t in args)
print("py_cmp_func", a, b)
return a-b
qsort(ia,len(ia),sizeof(c_int),py_cmp_func) |
|
Date |
User |
Action |
Args |
2008-11-05 05:51:04 | LambertDW | set | recipients:
+ LambertDW, georg.brandl |
2008-11-05 05:51:03 | LambertDW | set | messageid: <1225864263.85.0.365773038706.issue4260@psf.upfronthosting.co.za> |
2008-11-05 05:51:02 | LambertDW | link | issue4260 messages |
2008-11-05 05:51:01 | LambertDW | create | |
|