Python complaints

Eric Jacobs x at x.x
Wed Nov 24 23:20:36 CET 1999


maxm wrote:
> 
> > Mark Carroll (markc at chiark.greenend.org.uk) wrote:
> > [snip]
> > : Basically, I'd be really interested to learn: what _don't_ people like
> > : about Python?
> > [snip]
> 
> I miss deeply the ability to write:
> 
> i += 3
> Text += "Some new text\n"

There's a pretty good reason for this one, I think. The two statements:

  Text += "Some new text\n"
  List.append(9)

look sort of analogous. Both seem to be taking an object and performing
a method on it. But strings are immutable; you can't perform any method
on it to change the string. The syntax

  Text = Text + "Some new text\n"

makes it clear that we're creating a new object out of an old one, and
assigning it to the variable "Text".

Sure, you could interpret += to mean the same thing, but I think it
would be less clear to those trying to learn the language. It's critical
to get people out of C mindsets in order to be able to understand
what people mean when they say "everything is a reference."




More information about the Python-list mailing list