Casey Duncan wrote: > I think this is an important feature, which allows you to define > generic, reusable getter and setter functions and pass static metadata > to them at runtime. Admittedly I have never needed the full pointer, > my typical usage is to pass in an offset. > > I think this should only be removed if a suitable mechanism replaces > it, if not it will require some needless duplication of code in > extensions that use it (in particular my own) 8^) I disagree; I think it is a minor convenience feature, and one which encourages a lack of type safety. A suitable replacement mechanism already exists in C: static PyObject *generic_getter(PyObject *o, int context) { /* your generic code goes here */ } static PyObject *getter_with_context_1(o) { return generic_getter(o, 1); } static PyObject *getter_with_context_2(o) { return generic_getter(o, 2); } static PyObject *getter_with_context_3(o) { return generic_getter(o, 3); } You would then use "getter_with_context_1" &c in your PyGetSetDef. With a clever optimizing compiler this should result in no detectable slowdown or code bloat. However, you will be happy to learn there wasn't much support for this change, so it didn't make it into Python 3.1. /larry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20090508/f1956703/attachment-0001.htm>
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