john coppola wrote: > > Hello python developers. After discussions with Fred > about defining how property objects are created, I > decided to give it a whirl myself. After about minute > of piddling, I came up with something I thought would > be a hack but is quite interesting. > ... > ! property_init(PyObject *self, PyObject *args, PyObject *kwds) > { > ! PyObject *get = NULL, *set = NULL, *del = NULL, *doc = NULL; > ! static char *kwlist[] = {"fget", "fset", "fdel", "doc", 0}; > ! propertyobject *gs = (propertyobject *)self; > ! > ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO:property", > ! kwlist, &get, &set, &del, &doc)) > ! return -1; > ... > --- 1003,1023 ---- > } > > static int > ! property_init(PyObject *self, PyObject *args, PyObject *kw) > { > ! PyObject *get=NULL, *set=NULL, *del=NULL, *doc=NULL, *arg=NULL; > ! static char *kwlist[] = {"object", 0}; > ! propertyobject *gs = (propertyobject *)self; > ! if (!PyArg_ParseTupleAndKeywords(args,kw,"|O:property",kwlist,&arg)) > ! return -1; > ! > ! get = PyObject_GetAttrString(arg,"__get__"); > ! set = PyObject_GetAttrString(arg,"__set__"); > ! del = PyObject_GetAttrString(arg,"__del__"); > ! doc = PyObject_GetAttrString(arg,"__doc__"); Wouldn't this break the documented API ? If so, I'd suggest to provide a second constructor which exposes the new signature instead. Should be easy to do in Python... -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
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