[Python-Dev] Re: [Python-checkins] python/dist/src/Modules cStringIO.c, 2.45, 2.46

Barry Warsaw barry at python.org
Fri Feb 27 09:46:29 EST 2004


On Fri, 2004年02月27日 at 05:55, Thomas Heller wrote:
> rhettinger at 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


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /