Guido van Rossum wrote:
> Try this:
>
> if (PyInstance_Check(obj)) {
> bound_method = PyObject_GetAttr(obj, str__format__);
> if (!bound_method)
> return NULL;
> <call it passing only the format string>
> Py_DECREF(bound_method);
> return <whatever the call returned>
> }
> else {
> do it the py3k way;
> }
Yes! I had converged on something similar. Also, in the !bound_method
branch, I convert using str() or unicode() to get the same behavior as
object.__format__.
I have one more question, which I'll start in another thread.
Eric.
_______________________________________________
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