Re: [Python-Dev] Calling a builtin from C code; PEP 3101 format() builtin

2008-02-15 Thread Eric Smith
Eric Smith wrote: > Greg Ewing wrote: >> Eric Smith wrote: >> >>> 1: exposing builtin_format(), probably giving it another name >>> (PyObject_Format?) and moving it somewhere other than bltinmodule.c. >> PyObject_Format sounds more like an API for invoking the >> __format__ lookup mechanism. Maybe

Re: [Python-Dev] Calling a builtin from C code; PEP 3101 format() builtin

2008-02-15 Thread Eric Smith
Greg Ewing wrote: > Eric Smith wrote: > >> 1: exposing builtin_format(), probably giving it another name >> (PyObject_Format?) and moving it somewhere other than bltinmodule.c. > > PyObject_Format sounds more like an API for invoking the > __format__ lookup mechanism. Maybe something like > PyOb

Re: [Python-Dev] Calling a builtin from C code; PEP 3101 format() builtin

2008-02-14 Thread Eric Smith
Greg Ewing wrote: > Eric Smith wrote: > >> 1: exposing builtin_format(), probably giving it another name >> (PyObject_Format?) and moving it somewhere other than bltinmodule.c. > > PyObject_Format sounds more like an API for invoking the > __format__ lookup mechanism. Maybe something like > PyOb

Re: [Python-Dev] Calling a builtin from C code; PEP 3101 format() builtin

2008-02-14 Thread Greg Ewing
Eric Smith wrote: > 1: exposing builtin_format(), probably giving it another name > (PyObject_Format?) and moving it somewhere other than bltinmodule.c. PyObject_Format sounds more like an API for invoking the __format__ lookup mechanism. Maybe something like PyObject_DefaultFormat would be bett

Re: [Python-Dev] Calling a builtin from C code; PEP 3101 format() builtin

2008-02-14 Thread Nick Coghlan
Eric Smith wrote: > I see 2 approaches: > > 1: exposing builtin_format(), probably giving it another name > (PyObject_Format?) and moving it somewhere other than bltinmodule.c. > > 2: Instead of calling the C code directly, lookup "format" in Python's > builtins, and call it. This, I think, wou

Re: [Python-Dev] Calling a builtin from C code; PEP 3101 format() builtin

2008-02-14 Thread Georg Brandl
Eric Smith schrieb: > While implementing "".format(), I need to call the builtin format() > function, which I've already implemented (in > bltinmodule.c:builtin_format()). In the py3k branch, I just hardcoded > the same functionality into "".format(), which seems like the wrong > thing to do, giv

[Python-Dev] Calling a builtin from C code; PEP 3101 format() builtin

2008-02-14 Thread Eric Smith
While implementing "".format(), I need to call the builtin format() function, which I've already implemented (in bltinmodule.c:builtin_format()). In the py3k branch, I just hardcoded the same functionality into "".format(), which seems like the wrong thing to do, given how complex the code is. I