python/dist/src/Modules cStringIO.c,2.45,2.46
Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15164 Modified Files: cStringIO.c Log Message: Speed-up the joiner call by avoiding Py_BuildValue(). Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** cStringIO.c 12 Oct 2003 19:09:36 -0000 2.45 --- cStringIO.c 27 Feb 2004 10:30:49 -0000 2.46 *************** *** 437,441 **** if (PyObject_Size(args) < 0) return NULL; ! tmp = PyObject_CallFunction(joiner, "O", args); UNLESS (tmp) return NULL; --- 437,445 ---- if (PyObject_Size(args) < 0) return NULL; ! args = PyTuple_Pack(1, args); ! if (args == NULL) ! return NULL; ! tmp = PyObject_Call(joiner, args, NULL); ! Py_DECREF(args); UNLESS (tmp) return NULL;
rhettinger@users.sourceforge.net writes:
if (PyObject_Size(args) < 0) return NULL;
! args = PyTuple_Pack(1, args); ! if (args == NULL) ! return NULL; ! tmp = PyObject_Call(joiner, args, NULL); ! Py_DECREF(args); UNLESS (tmp) return NULL;
There are both tabs and spaces in this code. Question: is there a convention about tabs and spaces in C code? Thomas
On Fri, 2004-02-27 at 05:55, Thomas Heller wrote:
rhettinger@users.sourceforge.net writes:
if (PyObject_Size(args) < 0) return NULL;
! args = PyTuple_Pack(1, args); ! if (args == NULL) ! return NULL; ! tmp = PyObject_Call(joiner, args, NULL); ! Py_DECREF(args); UNLESS (tmp) return NULL;
There are both tabs and spaces in this code. Question: is there a convention about tabs and spaces in C code?
Personally, I'd like to see all the Python C code be reformatted to 4 space indents, or at least, new C modules to be indented that way. However, PEP 7 is the C style guide for Python code, and it clearly lays out the rule: - Use single-tab indents, where a tab is worth 8 spaces. and: (2) To be consistent with surrounding code that also breaks [a rule] (maybe for historic reasons) -- although this is also an opportunity to clean up someone else's mess (in true XP style) So. Be consistent but default to using tabs. -Barry http://www.python.org/peps/pep-0007.html
participants (3)
-
Barry Warsaw
-
rhettingerīŧ users.sourceforge.net
-
Thomas Heller