Neal Norwitz schrieb: > I'm glad to see Anthony ratcheting down. At this point, we need to be > fixing bugs and improving doc. Maybe Anthony and I should have a > contest to see who can revert the most changes. :-) > Neal (and/or Anthony), I would like to ask about the possibility to add some improvements to ctypes in Python 2.5, although the feature freeze is now in effect. Hopefully former third-party libraries can have the freeze relaxed somewhat;-). I intend to do these changes, the first is a small and trivial one, but allows a lot of flexibility: - Remove the restriction that the argtypes attribute of foreign functions must be ctypes types. Instead they are only required to implement a .from_param class method. The advantage is that custom objects can be used as function parameters. One usecase is to allow numpy arrays as function parameters without any conversion - this change at least allows to code this in Python. The patch is attached as from_param.patch. The second one is more involved, and not yet complete. I can post the patch or a link to it for review when it is implemented completely: - Implement the __array_struct__ attribute as describes by the numpy pep at http://numpy.scipy.org/array_interface.html. The properties needed to implement the __array_struct__ attribute could be calculated from a given ctypes array type, however, it would be more efficient to calculate them at type creation time. This requires the StgDSictObject that holds information about the ctypes type to grow a few fields: 'int nd' - contains the number of dimensions, 'char typekind' - a struct-like character for the item type, and 'Py_intptr_t *shape' - an array of size 'nd' containing shape information. Thanks for investigating this, Thomas -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: from_param.patch Url: http://mail.python.org/pipermail/python-dev/attachments/20060704/3c0500e4/attachment.pot
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4