News for hackers. Stuff that matters.
Re:Python is now the most popular introductory language at t... by area51org on Tuesday July 08, 2014 @03:25AM (#8003367)
I know, I know, what I'm about to say is just an artifact of the Language Wars and will cost me karma. I can't help myself.

We should not be teaching impressionable students that whitespace has semantic significance. This is a fundamental design flaw of Python, and it's just a Bad Idea.

Sorry, Guido.

Re:Python is now the most popular introductory language at t... by __david__ on Tuesday July 08, 2014 @06:14AM (#8003764)
> This is a fundamental design flaw of Python, and it's just a Bad Idea.

That sounds like a gut reaction and not a reasoned argument. I was skeptical of it at first, but after coding some Python I decided all my reasons for hating it weren't valid. Turns out it's very practical and makes the code prettier. I don't like the language for other reasons, but the significant whitespace never gave me any problems, headaches, or weird spurious bugs.

The only negative thing about it for me was that hitting TAB in Emacs doesn't indent to the "proper" place (since it's impossible to actually determine the proper place). Instead, it would alternate amongst the valid tab points from most likely to least, which felt like a reasonable compromise to me.

Interestingly, I never hear anyone whine about Haskell's use of significant whitespace…

Re:Python is now the most popular introductory language at t... by e12e on Tuesday July 08, 2014 @05:39PM (#8006873)
I was bit by haskell's whitespace - but I think that was connected to a bug with the do-notation or some such syntactic sugar. In general I think significant whitespace is a great way to deliniate blocks
Re:Python is now the most popular introductory language at t... by toyg on Tuesday July 08, 2014 @06:45AM (#8003867)
I guess you agree that "impressionable students" should be taught that collaboration is essential, hence clear formatting is necessary and precise indentation (aka whitespace) is critical.

However, when a language comes around that actively enforces and promotes these rules... you say it's a "Bad Idea". Could you elaborate on why you think it's so bad?

Re:Python is now the most popular introductory language at t... by 6d0debc071 on Tuesday July 08, 2014 @07:05AM (#8003911)
> I guess you agree that "impressionable students" should be taught that collaboration is essential, hence clear formatting is necessary and precise indentation (aka whitespace) is critical.

Not particularly, no. Or at least I think that should be the IDE's problem.

Re:Python is now the most popular introductory language at t... by toyg on Tuesday July 08, 2014 @07:44AM (#8004003)
*> Not particularly, no. Or at least I think that should be the IDE's problem.

You still have to tell the IDE what to do with your code, which you do with brackets, I guess?

So now your code is full of brackets and parentheses, which are naturally less readable (how many levels of parentheses do you use in natural language?), and their role is almost entirely to... help the IDE indent your code.

Re:Python is now the most popular introductory language at t... by 6d0debc071 on Tuesday July 08, 2014 @08:53AM (#8004264)
About as many carriage returns as I use in natural language. The act of inserting any sort of punctuation seems inherently approximate; an attempt to encode that which is usually transmitted in tone, rhythm, body language.

People, even before computers, invented several different types of formal logic notation just so that they'd have a language that was better suited to these sorts of puzzles. I don't think that code is a good approximation of natural language, nor do I think that it should try to be. Natural language is very poorly suited to expressing layers of abstraction, and even basic logical relationships.

Of course it's easier to write programs that resemble natural language, just as it's also easier to speak than it is to write Vx[Yx->...etc...] but that doesn't mean it's the best way to look at a problem.

#

But that's a bit besides the point. You can do it however you like, even with whitespace if that's your preference. The key is that the IDE has to be aware of the meaning of your code. Python's solution to that is to assert by fiat that the white space should be a syntactically meaningful unit in this sense, but it could be anything.

If you have the information there, then people can look at it and write it however they please.

Re:Python is now the most popular introductory language at t... by serf on Wednesday July 09, 2014 @01:38AM (#8008223)
>how many levels of parentheses do you use in natural language?

2 or 3 (but I write mostly lisp (as a programming language) and I usually mumble them (the natural languages)..).

  (seriously.)
edit : screw commas, let's go nuts with parentheses.
Re:Python is now the most popular introductory language at t... by chillingeffect on Tuesday July 08, 2014 @03:50AM (#8003428)
Iagree100%.Therereallyisnoreasontoattributetheattributeofseman ticallysignificanttowhitepsace.Justasineverydaylanguage,comput erprogrammersshouldhavethefreedomtonotusewhitespaceastheyseefi t,justasmusicshouldnothaverests;it'sonlythenotesthathavemeanin g.Finally,gentlepeople,Iimploreyouthatwallsinhousesshouldbemad einfinitesimallythin,too,becauseIseenoneedtoseparateanything.
Re:Python is now the most popular introductory language at t... by Doctor_Fegg on Tuesday July 08, 2014 @04:41AM (#8003573)
Please don't break everyone's formatting by writing something quite so long that won't wrap. Thanks.
Re:Python is now the most popular introductory language at t... by gpvos on Tuesday July 08, 2014 @05:52AM (#8003702)
People, if you install a comment collapser like the greasemonkey script on this page, you can hide the above post.

http://alexander.kirk.at/2010/02/16/collapsible-threads-for-...

Re:Python is now the most popular introductory language at t... by rectangletangle on Tuesday July 08, 2014 @06:17AM (#8003774)
I happen to like this comment, it gets the point across.
Re:Python is now the most popular introductory language at t... by McP on Tuesday July 08, 2014 @05:15AM (#8003632)
Can someone delete this comment please? I'd like to read the other comments here but this one means I've got to scroll back and forth for each line :(
Re:Python is now the most popular introductory language at t... by NinjaViking on Tuesday July 08, 2014 @05:49AM (#8003696)
For a temporary solution, try right-clicking on it, select "inspect element" or something to that effect and deleting the text.
Re:Python is now the most popular introductory language at t... by Rynant on Tuesday July 08, 2014 @10:18AM (#8004611)
I use a bookmarklet that comes in handy in cases like this:

  javascript:(function()%7Bfunction callback()%7B(function(%24)%7Bvar jQuery%3D%24%3B%3B%24('*').on("contextmenu"%2C function(evt) %7Bevt.preventDefault()%3B%7D)%3B%24('*').mousedown(function(evt)%7Bif(evt.which%3D%3D%3D3)%7Bevt.srcElement.remove()%3B%7D%7D)%7D)(jQuery.noConflict(true))%7Dvar s%3Ddocument.createElement("script")%3Bs.src%3D"https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js"%3Bif(s.addEventListener)%7Bs.addEventListener("load"%2Ccallback%2Cfalse)%7Delse if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
After clicking the bookmarklet, you can right-click on any element to remove it.
Re:Python is now the most popular introductory language at t... by VexXtreme on Tuesday July 08, 2014 @05:28AM (#8003653)
You know what man, FUCK YOU. You broke the layout of the discussion for everyone and it's next to impossible to follow the conversation without a ton of horizontal scrolling. Take your trolling elsewhere, it's not welcome here.
Re:Python is now the most popular introductory language at t... by dang on Tuesday July 08, 2014 @04:17PM (#8006542)
Whoa, please don't. This comment would be fine if it were just the second sentence.