[Python-3000] format and datetime (original) (raw)

Eric Smith eric+python-dev at trueblade.com
Tue Sep 11 14:47:12 CEST 2007


Eric Smith wrote:

I have a patch to add format to datetime.time, .date, and .datetime. For non-empty formatspec's, I just pass on to .strftime. For empty formatspec's, it returns str(self).

What's the best way to call str(self)?

I'm currently doing: if (PyUnicode_GetSize(format) == 0) return PyObject_CallMethod((PyObject *)self, "str", NULL);

Although this works, calling self.str doesn't seem like the right thing to do.

Thanks.



More information about the Python-3000 mailing list