Possible Duplicate:
drop trailing zeros from decimal
How do I get the shortest representation of a Decimal that compares equal?
For example:
Decimal('89.00')->'89'Decimal('123.010')->'123.01'Decimal('0.0')->'0'
Currently, I have my own implementation which first converts to a string, with
if chanstr.endswith('0'):
    chanstr = chanstr[:chanstr.rfind('.')]
which works fine and is only 2 LOC; but is there a better way to write this?