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

Zigron zigron at jps.net
Wed Jun 23 02:00:43 EDT 1999


Reimer Behrends <behrends at cse.msu.edu> wrote in message
news:slrn7n0rr2.2fi.behrends at allegro.cse.msu.edu...
> Preston Landers (planders at mail.utexas.edu) wrote:
> Personally, I can easily live without a construct that I can use on
> average once every three screens of code or so. On the other hand, I
> _am_ getting pretty sick of having to type self.whatever countless
> times, where pretty much any other language allows me to discard the
> "self." part. Not only is it annoying to type, it also reduces the
> readability of OO code a lot, much like the gratuitious use of
> punctuation characters as variable prefixes in Perl does.
>
> 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 self.attribute thing makes sense. Each object has its own scope,
er, namespace, whatever. Methods are considered objects, as are
classes. Removing the 'self' requirement would, to me, change that.
Methods wouldn't be objects anymore. :) At least it seems so to me,
.. they'd  be almost-objects, maybe. 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'! :-))

    I think that would have further reprocussions, maybe,..maybe not,
dunno. I'm just a newbie.

--Stephen







More information about the Python-list mailing list