TABS in the CPython C source code
Alf P. Steinbach
alfps at start.no
Sat Feb 6 16:12:05 EST 2010
* Andrej Mitrovic:
> On Feb 6, 9:31 pm, "Alf P. Steinbach" <al... at start.no> wrote:
>> Just trying to delve into the CPython source code.
>>
>> Pleasant surprise: while e.g. the gcc compiler is written in K&R C (1975 style
>> C), CPython seems to be written in almost modern C (1989 and on).
>>
>> But, hey, TABS used for indenting, combined haphazardly and randomly with SPACES
>> used for indenting, in the same source files...
>>
>> The size-8 tabs look really bad in an editor configured with tab size 4, as is
>> common in Windows. I'm concluding that the CPython programmers configure their
>> Visual Studio's to *nix convention. Or perhaps modern Visual Studio has default
>> tab size 8, it wouldn't surprise me (the best version was the MSVC 6.0 Developer
>> Studio, since then that IDE has only gone downhill being re-based on the Office
>> Assistant inspired "for dummies" IDE that Microsoft had for web designers).
>>
>> Anyways, I would suggest converting all those tabs to spaces, as e.g. the Boost
>> library project does -- no tabs allowed.
>>
>> That's much more platform-independent. :-)
>>
>> Cheers,
>>
>> - Alf
>
> So what's stopping you from doing this yourself?
Depends what "this" you're referring to.
If by "this" you mean, automatically converting tabs to spaces on checking out a
newer version of a CPython source file, nothing in particular stops anyone from
doing that. But it's needless work, and it results in "false positive" changes
when checking in something. That's why e.g. Boost standardizes on spaces.
If by "this" you mean, changing the coding guidelines (if such exist) for the
CPython project, well I'm not involved, so the best I can do is to float the
idea and point to existing practice in other projects, which I've now done. :-)
Cheers & hth.,
- Alf
More information about the Python-list
mailing list