I should point out that capitalize(), of course, returns a new capitalized string, just as it does in Ruby. But in Ruby you also have String#capitalize!
And as for indentation, I think Guido should have followed through with making tabs a syntax error, because they are part of the syntax and are fiendish sources of error. Let's just say you have this code, properly indented with spaces:
class X:
def visible(self):
pass
And you open it in a non-Python-aware editor, say for Windows, which has a four-space tab length and does not convert them to spaces. You add:
def invisible(self):
pass
at the end of the file using your tab key. Now you have a potentially crazy-hard-to-figure-out bug.
I should point out that capitalize(), of course, returns a new capitalized string, just as it does in Ruby. But in Ruby you also have String#capitalize!
So the quote deals with mutability? I suppose that makes more sense, since Ruby tends to favor mutable objects. Of course, to my Python-based mind changing the definition of 'a' or 3 seems like a poor idea.
And as for indentation, I think Guido should have followed through with making tabs a syntax error
Surely you mean "making spaces a syntax error"? That would be much more sensible, since using spaces for indentation is absurd. Even better would be simply ignoring spaces, since that allows them to be used for pretty-printing and alignment without any potential ambiguity.
Also, the bug in your example will not be difficult to figure out, because Python will/should raise an exception when parsing the malformed file. Not everybody runs with -tt, but that ought to be the default behavior (and is anywhere I get to control the installation).
Maybe you could consider a pre-commit hook which blocks /^\s* \t/ on * .py? Or if nothing else it's simple enough to grep/ack for.
I'd also recommend making indentation whitespace visible if your editor supports it - it is syntax after all. I have vim configured to colour leading spaces green, leading tabs as blue, and tabs following anything other than a tab highlighted red. Making inconsistent indentation ugly is quite effective, though sadly ineffective on other people.
And as for indentation, I think Guido should have followed through with making tabs a syntax error, because they are part of the syntax and are fiendish sources of error. Let's just say you have this code, properly indented with spaces:
And you open it in a non-Python-aware editor, say for Windows, which has a four-space tab length and does not convert them to spaces. You add: at the end of the file using your tab key. Now you have a potentially crazy-hard-to-figure-out bug.