wware-nospam at world.std.com
Tue Nov 30 15:12:49 CET 1999
Will Ware wrote:
> I find myself grumbling about having to type "x = x + 1". The really
> clean thing to do, given that integers are objects, would be to define
> increment and decrement methods, so you'd type something like "i.incr()".
Jesse D. Sightler (jsight at mindspring.com) wrote:
> Wouldn't this be impossible, since Integers are also immutable? So, eg,
> i.incr() could only return an incremented version of i, but not actually
> increment i?
Right, this is what Gordon was pointing out. A "++" method could not
magically reach out of its object, find the "i" variable, and bind it
to the incremented value. Something like this could be accomplished
by tinkering with Python's parser, but that wouldn't be a great idea.
A lot of work for something that would never find wide acceptance.
- - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware email: wware @ world.std.com
More information about the Python-list