Integers with leading zeroes

MRAB python at mrabarnett.plus.com
Wed Jul 22 11:38:20 EDT 2015


On 2015-07-22 16:27, Antoon Pardon wrote:
> On 07/22/2015 11:09 AM, alister wrote:
>> On Wed, 22 Jul 2015 09:12:59 +0200, Laura Creighton wrote:
>>
>>> The biggest use I have for decimal numbers that begin with 0 is in
>>> credit card numbers, account numbers and the like where the first check
>>> you do is 'does this thing have the correct number of digits'.
>>> So far, all the examples I've been able to find in my code -- which does
>>> this sort of stuff a lot -- is looking at string versions of decimal
>>> numbers, but I suspect there is old code out there in the wild which
>>> just used integers.
>>>
>>> Laura
>>
>> This type of information should be stored as a string not any type of
>> numeric format, if you are not performing maths on it then it is a string
>> & not a number.
>
> Does the same condition hold for strings? If you are not performing string
> operations on something, it is not a string?
>
Tkinter comes to mind. You specify how widgets are laid out strings
that are basically flags:

     text_widget.pack(side=LEFT, fill=BOTH, expand=YES)

where LEFT, BOTH and YES are strings.



More information about the Python-list mailing list