This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author LambertDW
Recipients LambertDW, georg.brandl
Date 2008-11-05.05:51:00
SpamBayes Score 0.030835608
Marked as misclassified No
Message-id <1225864263.85.0.365773038706.issue4260@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2008-11-05 05:51:04LambertDWsetrecipients: + LambertDW, georg.brandl
2008-11-05 05:51:03LambertDWsetmessageid: <1225864263.85.0.365773038706.issue4260@psf.upfronthosting.co.za>
2008-11-05 05:51:02LambertDWlinkissue4260 messages
2008-11-05 05:51:01LambertDWcreate