Python complaints

Jesse D. Sightler jsight at mindspring.com
Tue Nov 30 00:10:27 EST 1999


Will Ware wrote:
> 
> William J. King (wjk at wjk.mv.com) wrote:
> : 4. conversion of integer to a string ( which may exist but havn't found
> : yet)
> 
> Try this:
>         str(123)
> or:
>         hex(123)
> 
> : 2. would like something like  'increment'/'decrement' operators
> :         either in form:
> :                     "x++"  or "incr x" vice "x = x + 1 " but its ok
> 
> 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()".
> Then you'd want to go around looking for other objects for which

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?

-- 
---------------
Jesse D. Sightler
http://www.biddin.com/




More information about the Python-list mailing list