Kristján V. Jónsson wrote:
> One thing I have often lamented having in PyString_FromFormat (and
> cousins, like PyErr_Format) is to be able to integrate PyObject
> pointers. Adding something like %S and %R (for str() and repr()
> respectively) seems very useful to me. Is there any reason why this
> isn´t there?
Not sure what the specific use case is, but I think I would use
PyString_Format instead, and use everything you can use in a %
operator. If you want to avoid explicit argument tuple building,
you can also write
static PyObject *fmt = NULL;
if (!fmt) fmt = PyString_FromString("Foo %s bar %s foobar %d");
res = PyMethod_Call(fmt, "__mod__", "(OOi)", o1, o2, 42);
Regards,
Martin
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com