Augmented assignment augmentation?
Manus Hand
mjhand at concentric.net
Fri Sep 22 01:06:14 EDT 2000
Call me crazy, call it late at night, or both, but here goes....
Yes, I know that the vast majority of class methods don't return
an instance of that method, far different from the but....
With the addition of methods to the string class, I have changed
all of my code that was formerly:
line = string.upper(line)
to:
line = line.upper()
Well, with augmented assignment, I was thinking that one lookup
of the string could be avoided if augmented assignment was
augmented by adding the a "method call assignment" operator .=
So that:
line = line.upper()
could be written:
line .= upper()
Next I'll want "slice assignment":
word = word[2:]
would be rewritable as:
word [= 2:]
:-)
Don't jump me -- I'm (half?) wishing I could date this posting
April 1st. :-)
Foolish'ly yours,
Manus
More information about the Python-list
mailing list