News for hackers. Stuff that matters.
Re:Why People Should Learn Python by guitarbill on Wednesday August 24, 2016 @06:32AM (#12350979)
> how about an almost Erlang-like full stop?

This is just brackets/braces in disguise, at which point you might as well follow convention and use {}.

This is obviously a very personal issue, but for me, the whitespace has less cognitive load. E.g.: in languages with brackets, people usually still indent the code for readability.

I've also found that when teaching people to program, consistency works well. I think this is one of the reasons Python is easy to pick up, just because Python code consistently looks like Python.

Re:Why People Should Learn Python by pmontra on Wednesday August 24, 2016 @07:58AM (#12351343)
For those languages is not people who reindent code but it's the editor or the IDE. There is usually a key to force reindentation. That is possible because {} or even the end in Ruby are easy markers for the block (there are multiple markers for a block start in Ruby). Is there any automatical indentation function in some editor for Python? If not, it's Python the unfortunate language where people has to indent code to feed the compiler. I always hated doing the compiler's job.

I'm asking because I'm using Python little and only for short scripts, so I didn't bother investigating much. Still I've been bitten a couple of times by bugs introduced by moving code around and not noticing that a line was not indented correctly. That in Python and in Haml (http://haml.info/) If somebody knows about those tools I will appreciate and it will make my life easier. BTW, I'm fixing somebody's else Python scripts right now :-)

Re:Why People Should Learn Python by squeaky-clean on Wednesday August 24, 2016 @03:43PM (#12354678)
> For those languages is not people who reindent code but it's the editor or the IDE. There is usually a key to force reindentation.

Regardless of whom or what is doing the indentation, people still prefer reading code which is indented, even in a language which relies on braces or parenthesis for flow. The indenting is not for the compiler's sake, it has no problem understanding this: http://www.ioccc.org/2014/maffiodo1/prog.c

Also people get very picky and personal when it comes to indentation in ways that a computer can't always choose. I prefer to almost always indent and format my code myself, rather than letting the editor choose. Python is the only language I actually let my editor auto-format, because of PEP-8.

> Is there any automatical indentation function in some editor for Python?

Pretty much any editor will have a feature for this, or allow you to install a popular plugin for it in less than a minute.

Re:Why People Should Learn Python by pmontra on Wednesday August 24, 2016 @06:04PM (#12355610)
How does it know that a line pasted to the end of a block from another indentation level belongs to that block or should go after the end of the block?

    if cond:
      line
  pasted line # where does it go?