Python 3.10 Fizzbuzz

avi.e.gross at gmail.com avi.e.gross at gmail.com
Tue Feb 28 16:05:19 EST 2023


Dave, 

Is it rude to name something "black" to make it hard for some of us to remind them of the rules or claim that our personal style is so often the opposite that it should be called "white" or at least shade of gray?

The usual kidding aside, I have no idea what it was called black but in all seriousness this is not a black and white issue. Opinions may differ when a language provides many valid options on how to write code. If someone wants to standardize and impose some decisions, fine. But other may choose their own variant and take their chances.

I, for example, like certain features in many languages where if I am only doing one short line of code, I prefer to skip the fanfare. Consider an (non-python)

If (condition) {
    print(5)
}

Who needs that nonsense? If the language allows it:

If (condition) print(5)

Or in python:

If condition: print(5)

Rather than a multi-line version.

But will I always use the short version? Nope. If I expect to add code later, might as well start with the multi-line form. If the line gets too long, ditto. And, quite importantly, if editing other people's code, I look around and follow their lead.

There often is no (one) right way to do things but there often are many wrong ways. Tools like black (which I know nothing detailed about) can be helpful. But I have experience times when I wrote carefully crafted code (as it happens in R inside the RSTUDIO editor) and selected a region and asked it to reformat, and gasped at how it ruined my neatly arranged code. I just wanted the bit I had added to be formatted the same as the rest already was, not a complete re-make. Luckily, there is an undo. 

There must be some parameterized tools out there that let you set up a profile of your own personal preferences that help keep your code in your own preferred format, and re-arrange it after you have done some editing like copying from somewhere else so it fits together.

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com at python.org> On Behalf Of dn via Python-list
Sent: Tuesday, February 28, 2023 2:22 PM
To: python-list at python.org
Subject: Re: Python 3.10 Fizzbuzz

On 28/02/2023 12.55, Rob Cliffe via Python-list wrote:
> 
> 
> On 27/02/2023 21:04, Ethan Furman wrote:
>> On 2/27/23 12:20, rbowman wrote:
>>
>> > "By using Black, you agree to cede control over minutiae of hand- 
>> > formatting. In return, Black gives you speed, determinism, and 
>> > freedom from pycodestyle nagging about formatting. You will save 
>> > time and
>> mental
>> > energy for more important matters."
>> >
>> > Somehow I don't think we would get along very well. I'm a little on 
>> > the opinionated side myself.
>>
>> I personally cannot stand Black.  It feels like every major choice it 
>> makes (and some minor ones) are exactly the opposite of the choice I 
>> make.
>>
>> --
>> ~Ethan~
> I've never tried Black or any other code formatter, but I'm sure we 
> wouldn't get on.

Does this suggest, that because Black doesn't respect other people's opinions and feelings, that it wouldn't meet the PSF's Code of Conduct?

--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list