[webkit-dev] Formatting style for inline comments in Python code

Maciej Stachowiak mjs at apple.com
Thu Oct 26 10:21:59 PDT 2017



> On Oct 26, 2017, at 10:20 AM, Eric Carlson <eric.carlson at apple.com> wrote:
> 
> 
> 
>> On Oct 26, 2017, at 9:50 AM, Brian Burg <bburg at apple.com <mailto:bburg at apple.com>> wrote:
>> 
>> 
>> 
>>> 2017/10/26 午前9:21、Alexey Proskuryakov <ap at webkit.org <mailto:ap at webkit.org>>のメール:
>>> 
>>> 
>>> 
>>>> 25 окт. 2017 г., в 18:21, Michael Catanzaro <mcatanzaro at igalia.com <mailto:mcatanzaro at igalia.com>> написал(а):
>>>> 
>>>> On Wed, Oct 25, 2017 at 4:58 PM, Aakash Jain <aakash_jain at apple.com <mailto:aakash_jain at apple.com>> wrote:
>>>>> Does anyone else has any opinion/preference for this?
>>>> 
>>>> The number of spaces before a comment really does not matter, but my $0.02: PEP8 is an extremely common style for Python programs that all Python developers are familiar with. I would follow that, and forget about trying to adapt WebKit C++ style to an unrelated language. Trying to adapt the style checker to ignore particular PEP8 rules seems like wasted effort.
>>> 
>>> 
>>> There is definitely a number of PEP8 rules that we want to follow. But I don't think that there is anything about the two space before comment rule that makes it particularly fitting for Python.
>> 
>> This is entirely subjective, so: why differ from the vast majority of all other Python code in existence, just to be different? What's the point? PEP8 adherence is nearly universal among projects on PyPi, at least among those that run style linters.
>> 
>>> I think that we should target WebKit developers with the coding style as much as possible, not Python developers. As we all agree on the one space rule elsewhere, why make a part of the code base uncomfortably different for most WebKit developers?
>> 
>> I don't understand the distinction between WebKit developers and Python developers. Am I not a C++ developer and web developer as well?
>> 
>> If "WebKit developers" want to write Python code, perhaps they should learn the Pythonic idioms of the language, just as they would use idioms of Perl, JavaScript, and C++. For better or worse, PEP8 encodes many of these idioms.
>> 
>> If someone already knows Python, they will be tripped up by this divergence and waste some minutes trying to satisfy the style checker, or just ignore it. If they don't know Python well, then they are being conditioned to follow some variant that has no benefit and is different from what they would see in any other Python code.
>> 
>> I see no value in adding arbitrary barriers to new contributions in Python code. The code has enough problems as-is, we don't need to make up our own for some pretense of consistency. We import other Python projects into the tree, and they follow PEP8, so what was proposed is to make the Python code in the tree *less* internally consistent.
>> 
> 
> +1

I'm very used to WebKit style for C++, and I agree that we should use PEP8 style for Python even where it differs from our C++ style.

 - Maciej


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20171026/48b78785/attachment.html>


More information about the webkit-dev mailing list