On Tue, 22 Feb 2011 11:06:41 -0800 Guido van Rossum <gu...@python.org> wrote: > > > > Probably because (a) the person who first wrote them used char* instead of > > const char*, and (b) it gives us API flexibility by not promising to not > > alter the char array at some point in the future. > > I'm sorry, but (b) does not make sense. These APIs typically get > passed string literals and modifying the argument would be a bad idea.
+1. If we started mutating strings passed to such APIs, it would certainly break a lot of third-party code. > FWIW, in Python 3.2, PySys_GetObject() is actually using const char *. > I don't see a problem with changing PyObject_CallMethod() and its > variations as well. > > Though I do not get that warning -- which compiler and version issues > it? Is it a C or a C++ compiler? Well, which warning are you talking about? I don't think changing a "char *" to a "const char *" specification would be harmful, since it makes the API more tolerant: with the latter, you can pass it both const and non-const strings. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com