News for hackers. Stuff that matters.
Re:Python with Braces by xigoi on Monday July 08, 2024 @05:01PM (#40909650)
> There is no redundant signal that can be checked for a discrepancy that could indicate a problem.

What’s the problem with having no redundancy? By the same logic, we should require numerals to be spelled out in words so the compiler can check if the programmer didn’t accidentally write a different number.

  def fahrenheit_to_celsius(x): {
      return (x - 32 [thirty two]) * 5 [five] / 9 [nine];
  }
Re:Python with Braces by kelipso on Monday July 08, 2024 @06:39PM (#40910522)
Redundancy reduces likelihood of bugs. Your numbers example would too but it's obviously too much work for not enough benefit.
Re:Python with Braces by xigoi on Tuesday July 09, 2024 @03:10AM (#40913301)
Braces are also too much work for not enough benefit.
Re:Python with Braces by kelipso on Tuesday July 09, 2024 @10:45AM (#40916747)
Given the chronic inconvenience of significant whitespace, absolutely not.
Re:Python with Braces by necovek on Tuesday July 09, 2024 @12:48PM (#40918185)
That's an opinion that is largely disproven by the amount of working Python code in the world.

Why is it so hard to accept that this is your personal preference and is really not an "objective" statement?

Re:Python with Braces by kelipso on Tuesday July 09, 2024 @02:26PM (#40919270)
The reason for the popularity of python is mainly due to advertising it to programming newbies and non-programmers, not due to significant whitespace.
Re:Python with Braces by necovek on Wednesday July 10, 2024 @01:40PM (#40929362)
I never brought popularity up: that mostly leads to lots of small snippets but not a big amount of working code. You can have an unpopular language with a few productive actors producing lots of code.

I argue that "chronic inconvenience" is disproven by so many working programs. Even if one argues it's an inconvenience, it is a minor one or it would be hard for non-newbies to produce so much with Python.

Re:Python with Braces by kelipso on Wednesday July 10, 2024 @06:04PM (#40931975)
It’s a minor inconvenience, sure, I use python myself, but it’s definitely a chronic one. It annoys me every single time I code in python.
Re:Python with Braces by xigoi on Wednesday July 10, 2024 @03:08AM (#40924405)
It’s thee braces that are inconvenient. I have to indent my code anyway, so why add another redundant marker that I’ll have to mentally filter out all the time?
Re:Python with Braces by necovek on Tuesday July 09, 2024 @12:50PM (#40918208)
They are certainly more work and why I prefer significant whitespace, but I wouldn't really say "too much".

They are a preference, but neither is objectively better or worse.

Re:Python with Braces by kazinator on Monday July 08, 2024 @06:15PM (#40910338)
If we primarily relied on a whitespace representation of numbers, it would help to have digits there for the machine to look at and possibly diagnose against the whitespace.
Re:Python with Braces by necovek on Tuesday July 09, 2024 @12:53PM (#40918226)
(Almost) Every programmer in the world depends on whitespace to understand code: are you claiming that's not true?

If humans can do it, why wouldn't computer programs like interpreters do it?