11-digit integer literal on a 32-bit CPU
Patrick Phalen
python-list at teleo.net
Mon Mar 6 20:55:16 EST 2000
[Alex, on Mon, 06 Mar 2000]
:: Does this do what you want?
::
:: class Transaction_ID:
:: def __init__(self, id_number):
:: self.number = id_number
::
:: def __str__(self):
:: output = str(self.number)
:: output = '1' + (10 - len(output)) * '0' + output
:: return output
::
:: def next_id(self):
:: return Transaction_ID(self.number + 1)
::
:: print Transaction_ID(50)
Yes! Thanks. That's exactly the sort of cleverness I wasn't coming up
with.
More information about the Python-list
mailing list