Line continuation and comments

dn PythonList at DancesWithMice.info
Thu Feb 23 21:01:17 EST 2023


On 24/02/2023 12.45, Weatherby,Gerard wrote:
>> NB my PyCharm-settings grumble whenever I create an identifier which is
> only used once (and perhaps, soon after it was established). I
> understand the (space) optimisation, but prefer to trade that for
> 'readability'.
>> 
> I haven’t seen that one. What I get is warnings about:
> 
> def is_adult( self )->bool:
>      LEGAL_AGE_US = 21
>      return LEGAL_AGE
> 
> It doesn’t like LEGAL_AGE_US being all caps if declared in a function.

Yes, I suffered this one too.

The rationale comes from PEP-008 (Constants):

Constants are usually defined on a module level and written in all 
capital letters with underscores separating words.


Today, I wasn't criticised for:
> NB my PyCharm-settings grumble whenever I create an identifier which is
> only used once (and perhaps, soon after it was established). I
> understand the (space) optimisation, but prefer to trade that for
> 'readability'.

Perhaps that came from AWS CodeWhisperer which I have since abandoned, 
or maybe from SonarLint (which I've just checked to discover it is not 
working properly...)

-- 
Regards,
=dn



More information about the Python-list mailing list