[New-bugs-announce] [issue4260] ctypes.xFUNCTYPE are decorators.

David W. Lambert report at bugs.python.org
Wed Nov 5 06:51:03 CET 2008


New submission from David W. Lambert <lambertdw at corning.com>:

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)

----------
assignee: georg.brandl
components: Documentation
messages: 75515
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: ctypes.xFUNCTYPE are decorators.
type: feature request
versions: Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4260>
_______________________________________


More information about the New-bugs-announce mailing list