News for hackers. Stuff that matters.
Re:Why Is Python Growing So Quickly? by wickawic on Thursday September 14, 2017 @12:51PM (#15249863)
I always figured the people complaining about the whitespace thing are people whose code I really don't want to be reading anyway
Re:Why Is Python Growing So Quickly? by reificator on Thursday September 14, 2017 @02:14PM (#15250838)
Why is that?

My code has whitespace that reasonably closely matches Python's rules regardless of the language. I only say "reasonably closely" because I don't spend enough time in Python to really be sure about any potential gotchas.

But like PEP 20 says:

> Explicit is better than implicit.

Brackets are explicit. Whitespace is implicit.

Re:Why Is Python Growing So Quickly? by kevinmgranger on Thursday September 14, 2017 @02:21PM (#15250917)
Indentation is explicit.
Re:Why Is Python Growing So Quickly? by reificator on Thursday September 14, 2017 @02:44PM (#15251150)
Indentation is implicit, because you can't see the characters that cause it without turning on whitespace rendering. You only can tell it's there by either moving the cursor around or by observing gaps between characters and other characters or characters and the left margin.

And the end of a block, the lack of indentation that denotes that, is absolutely implicit.

Re:Why Is Python Growing So Quickly? by runevault on Thursday September 14, 2017 @01:55PM (#15250623)
The problem isn't whitespace period, its that if you aren't careful the significant whitespace can bite you, for example people sometimes accidentally mix tabs and spaces, which can get... ugly.

Personally I prefer {} blocks so I don't have to know what sort of white space is creating the indentation, even though I do miss using python sometimes and may come back to it for the right project.

Re:Why Is Python Growing So Quickly? by redblacktree on Thursday September 14, 2017 @02:48PM (#15251192)
> accidentally mix tabs and spaces, which can get... ugly.

This is trivially solved. You can find and replace with sed[0] if you want to be fancy, or just use your favorite text editor/IDE. The teams I've worked on have never had a problem with this. There is always an established convention in a project, and if you're breaking the convention -- e.g. because you prefer tabs -- you're doing it wrong, just by virtue of breaking the convention. If your project is new and you need to set a convention, do that. (also, PEP8 recommends spaces, so there is an authority to reference as a tie-breaker)

[0]: something like: find ./ -type f -exec sed -i -e 's/ / . /g' {} \;

Re:Why Is Python Growing So Quickly? by devrandomguy on Thursday September 14, 2017 @06:26PM (#15252997)
Furthermore, there is no need for anyone to care what spacing scheme their team uses, after configuring their editor on day 1 with that team. I have Vim convert Python code to tab indentation when opening files, and have it convert to 4-spaces indentation when saving a Python code file. No one should be wasting even a flicker of brain activity over indentation in the 21st century, regardless of how backwards everyone else's preferences are.

While you're at it, please also s/\s+$//g on save. Those unintentional trailing spaces really clutter up Git history, and that comprehensive, clean history is what enables the team leads to do their job without bugging you on Slack. It also signals carelessness, or at least a lack of care for personal tools, and has your name attached to it.

Re:Why Is Python Growing So Quickly? by ubernostrum on Thursday September 14, 2017 @04:30PM (#15252240)
people sometimes accidentally mix tabs and spaces

I just tried with three different editors, and literally could not manage to get code in a file indented with a mix of tabs and spaces despite actively attempting to. Who are your co-workers who actually personally have had this happen to them in, say, this decade (not nebulous stories from the internet of "I heard once about this"), and how did they do it?

Re:Why Is Python Growing So Quickly? by runevault on Thursday September 14, 2017 @09:40PM (#15253936)
I know I ran into it at one point, but I haven't slung python in anger in like a decade, so maybe the editors most people are using have started preventing this sort of thing better.

Though I do know in Visual Studio (what I do my day to day coding in these days) I've had situations at work where tabs and spaces got mixed together and at some point it finally started complaining but not right away.