[Tutor] creating and writing to a text file

dn PyTutor at DancesWithMice.info
Tue Mar 30 00:32:59 EDT 2021


On 30/03/2021 12.14, Cameron Simpson wrote:
> On 29Mar2021 16:48, boB Stepp <robertvstepp at gmail.com> wrote:
>> On 21/03/29 07:27PM, Phil wrote:
>>> I've never been sure when to use single or double quotes. Black 
>>> confirms that double quotes is the correct option in this case.
>>
>> Just to clear up any possible confusion Black is designed to prefer double
>> quotes over single quotes in every situation unless that is not possible to
>> do.  Just because Black double quotes something does *not* mean that is the
>> correct way to use quotes!
> 
> And to add to this, black's obsession with replacing my nice clean ''' 
> with horrible noisy """ is, alone, reason for me to refuse to use it.
> 
> Again, Heuer's Razor:
> 
>     If it can't be turned off, it's not a feature. - Karl Heuer
> 
> Black is for people who want consistent formatting (it certainly eases 
> diff churn etc once the formatting is done) but _don't_ care about 
> style.


-1 on the unnecessary diff-noise!

+1 "noise". I'd always used triple single-quotes for exactly that reason.

That said, one day I woke-up and found PEP-257
(https://www.python.org/dev/peps/pep-0257/) which does want
"""Docstrings.""".

For those who want an 'out', review the PEP's extremely strong language:
"If you violate these conventions, the worst you'll get is some dirty
looks. But some software (such as the Docutils [3] docstring processing
system [1] [2]) will be aware of the conventions, so following them will
get you the best results". So, the usual 'don't get too excited'
disclaimers apply.

Fast forward to modern ed/IDE tools, and when such add-ons kept whining
about the single-quotes, I asked 'if I let you make the changes, will
you go away and leave me in peace...'. What a push-over!
-- 
Regards,
=dn


More information about the Tutor mailing list