total idiot question: +=, .=, etc...

Joshua Rosen rozzin at
Wed Jun 23 22:32:43 EDT 1999

Zigron wrote:
> > Among all the suggestions for Python 2.0, removing the necessity of
> > prefixing methods and instance variables with "self." (and not having
> > to list it as an argument, either) would be my #1 wish.
>     Whyfor? I personally like the seperate scopes, beween the class
> and the method. It makes it so I don't have to clean up as much. I can
> use as many temporary variables as I want in a method, and as soon
> as that method is gone...... its gone.

	The other reason is that explicitely using a self-reference for instances goes
along with the method of calling unbound class-methods, and allows one to
easily `fake' membership of an instance in a class.

> I thought pv2 was going to
> objectify eeeeverything. (I can't tell you how much I want strings
> turned into objects! "blah".append('hi') should return 'blahhi'! :-))

	Last I checked, everything in Python already was an object;)
	Strings -are- objects--they just don't belong to a class or have any
properties/members/whateveryouwanttocallthem (some non-class--`top-level' I
suppose they should be called--objects do have members, like lists and
imaginary numbers).
	I rather like the var-name-subsitution that PERL and Ruby and some other
languages do (ie: $something="bar"; "foo$something" == "foobar"), because it
shortens code, and sometimes makes it much prettier (having stripped out all of
the `end string, use an operator, reference something, resume new string'
procedures); Python's %-replacement is nice, too, though a bit more lengthy.

	One thing to remember: languages all have their strengths and weaknesses, and
-rarely- is a language best for -everything-.

(back on track with the start of the thread: yeah, the shortcut operators
wouldn't really work well with Pythonic `assingment'/name-binding and immutable


More information about the Python-list mailing list