News for hackers. Stuff that matters.
Re:I don't like Python. Does that make me a bad person? by cageface on Saturday June 26, 2010 @10:16AM (#1463694)
Python's whitespace indentation seems like a great idea until you realize that it makes things like copying & pasting code from web pages etc far more difficult and, worse, makes automatically reindenting a block of code in an editor impossible. If I come across a badly formatted block of code in Ruby or Java or C in emacs it takes me one keypress to sort it out. In Python I have to carefully, manually look at each line.

It's also fun to spend an hour looking for a bug caused by somebody inserting a tab instead of a space somewhere. We had a production crash that took us a long time to fix because somebody hotfixed a file with the wrong editor and did this.

I also don't understand how forcing people to indent code in the same way magically makes people write good code. The kind of programmer that can't or won't indent his code properly is introducing bugs far more serious than bad layout into your project.

Python's a nice language in many ways but I consider the syntax to be a bug.

Re:I don't like Python. Does that make me a bad person? by Jeema3000 on Saturday June 26, 2010 @11:07AM (#1463760)
It's also very annoying to have to un-indent an entire block of code during debugging just because you want to comment out the conditional statement around it...
Re:I don't like Python. Does that make me a bad person? by ableal on Saturday June 26, 2010 @12:40PM (#1463888)
You could do what you say - comment the conditional:

    # if x:
    if 1:         # DEBUG
        block
Re:I don't like Python. Does that make me a bad person? by pjscott on Saturday June 26, 2010 @03:22PM (#1464132)
Or, even quicker and dirtier:

    if 1: # x:
        block
Re:I don't like Python. Does that make me a bad person? by prodigal_erik on Saturday June 26, 2010 @09:21PM (#1464659)
> it makes things like copying & pasting code from web pages etc far more difficult

This. I'm convinced half the reason Ruby is displacing Python is that it's actually practical to talk about Ruby code in forums without ridiculous little-known workarounds like pastebins.

Re:I don't like Python. Does that make me a bad person? by cageface on Sunday June 27, 2010 @05:22PM (#1466256)
I do think that it's a pretty major issue, although I also don't get the impression that Ruby is displacing Python. If anything it seems like the momentum from Rails is petering out a bit.

The Ruby community itself does strike me as more energetic though. All the activity on github etc seems a lot more impassioned to me than the coolheaded & practical world of Django et al.

Re:I don't like Python. Does that make me a bad person? by lars512 on Saturday June 26, 2010 @10:43AM (#1463735)
I consider the indentation approach excellent because it's so clear and readable. For exactly the same reason, I prefer YAML over XML, because the result is something more readable, something whose structure is understandable at a glance.
Re:I don't like Python. Does that make me a bad person? by sbov on Saturday June 26, 2010 @01:40PM (#1463971)
I'm willing to forgive the creators of Python if they didn't optimize their syntax for copying-and-pasting code.

Hotfixing is a naturally perilous process regardless of language. I've spent hours tracking down untested hotfixes in Java.

You're also probably less likely to come across a badly formatted block of python code because that would generally result in a bug. Much like misplaced brackets in Java/C/C++ would result in a bug.

It doesn't make the code magically better. It makes it less redundant. Indentation should already be there, why do you need curly brackets?

Re:I don't like Python. Does that make me a bad person? by cageface on Saturday June 26, 2010 @05:41PM (#1464331)
I'm willing to forgive the creators of Python if they didn't optimize their syntax for copying-and-pasting code.

Copying and pasting is also known as refactoring. A syntax that makes that much harder than it needs to be is mis-optimized, IMO.

Re:I don't like Python. Does that make me a bad person? by Jach on Saturday June 26, 2010 @07:05PM (#1464469)
But code is read far more than refactored, so I think it's an okay tradeoff. (Plus what editors are ya'll using where changing the indentation of something is difficult?)