osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

why no camelCase in PEP 8?


On 5/19/20 4:02 AM, Barry Scott wrote:
>
>> On 18 May 2020, at 22:07, Eli the Bearded <*@eli.users.panix.com> wrote:
>>
>> 	camelCase	->	 noCamelCase
>> 	snake_case	->	 no_snake_case
>>
>> One of those is easier to "grep" for than the other.
> I guess you mean that a case-sensitive grep can tell
> camelCase from noCamelCase.
>
> In all cases you need to use a \b to mark the boundary of the word.
> Otherwise the RE will match more than you expect, assuming a
> large set of identifiers.
>
> grep '\bsnake_case\b *.py
>
> Barry
>
I think the issue is that you can easy search for all 'snake_case' and
get them, but you have more difficulty searching for all 'camelCase',
needing to go case insensitive, but if leading case matters (like there
is a type CamelCase that you don't want) you get unwanted hits.

-- 
Richard Damon