Re: Integers with leading zeroes

2015-07-24 Thread alister
On Wed, 22 Jul 2015 20:11:47 -0600, Michael Torrie wrote: > On 07/22/2015 07:51 AM, Grant Edwards wrote: >> On 2015-07-22, Ben Finney wrote: >>> Laura Creighton writes: >>> The biggest use I have for decimal numbers that begin with 0 is in credit card numbers, account numbers and the l

Re: Integers with leading zeroes

2015-07-23 Thread Chris Angelico
On Fri, Jul 24, 2015 at 4:23 PM, Gregory Ewing wrote: > Michael Torrie wrote: >> >> A credit card number is indeed a number, and there are >> mathematical formulas for determining if a particular number is a valid >> (as in well-formed) credit card number, > > > If you're talking about the check-d

Re: Integers with leading zeroes

2015-07-23 Thread Gregory Ewing
Michael Torrie wrote: A credit card number is indeed a number, and there are mathematical formulas for determining if a particular number is a valid (as in well-formed) credit card number, If you're talking about the check-digit algorithm, that doesn't treat the whole number as an integer, it w

Re: Integers with leading zeroes

2015-07-23 Thread Michael Torrie
On 07/22/2015 07:51 AM, Grant Edwards wrote: > On 2015-07-22, Ben Finney wrote: >> Laura Creighton writes: >> >>> 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

Re: Integers with leading zeroes

2015-07-22 Thread Chris Angelico
On Thu, Jul 23, 2015 at 1:38 AM, MRAB wrote: >> 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(s

Re: Integers with leading zeroes

2015-07-22 Thread MRAB
On 2015-07-22 16:50, Grant Edwards wrote: On 2015-07-22, MRAB wrote: On 2015-07-22 16:27, Antoon Pardon wrote: 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

Re: Integers with leading zeroes

2015-07-22 Thread Grant Edwards
On 2015-07-22, MRAB wrote: > On 2015-07-22 16:27, Antoon Pardon wrote: > >> 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:

Re: Integers with leading zeroes

2015-07-22 Thread Grant Edwards
On 2015-07-22, Antoon Pardon wrote: > Does the same condition hold for strings? If you are not performing string > operations on something, it is not a string? If you never need to do any string operations on it then you should not be using a string. -- Grant Edwards grant.b.edwa

Re: Integers with leading zeroes

2015-07-22 Thread MRAB
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

Re: Integers with leading zeroes

2015-07-22 Thread Antoon Pardon
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 numb

Re: Integers with leading zeroes

2015-07-22 Thread Grant Edwards
On 2015-07-22, Steven D'Aprano wrote: > On Wed, 22 Jul 2015 11:51 pm, Grant Edwards wrote: > >> On 2015-07-22, Ben Finney wrote: >>> Laura Creighton writes: >>> The biggest use I have for decimal numbers that begin with 0 is in credit card numbers, account numbers and the like where th

Re: Integers with leading zeroes

2015-07-22 Thread Steven D'Aprano
On Wed, 22 Jul 2015 11:51 pm, Grant Edwards wrote: > On 2015-07-22, Ben Finney wrote: >> Laura Creighton writes: >> >>> 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 ha

Re: Integers with leading zeroes

2015-07-22 Thread Rustom Mody
On Wednesday, July 22, 2015 at 7:21:29 PM UTC+5:30, Grant Edwards wrote: > On 2015-07-22, Ben Finney wrote: > > Laura Creighton writes: > > > >> 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 d

Re: Integers with leading zeroes

2015-07-22 Thread Grant Edwards
On 2015-07-22, Ben Finney wrote: > Laura Creighton writes: > >> 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'. > > The following are exa

Re: Integers with leading zeroes

2015-07-22 Thread Marko Rauhamaa
Laura Creighton : > What I want to know is why is 'huoneen numero' 2 words? rummets nummer Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Integers with leading zeroes

2015-07-22 Thread INADA Naoki
Permitting leading 0s may make it harder to port Python 2 projects to Python 3. 010 == 8 (Python 2) 010 == 10 (Python 3.x) SyntaxError is very important for porting code. So I'm -1 on permitting leading 0s for decimal numbers. I think original question is for leading 0s for only 0. Not for arbi

Re: Integers with leading zeroes

2015-07-22 Thread Laura Creighton
In a message of Wed, 22 Jul 2015 12:10:55 +0300, Marko Rauhamaa writes: >My native Finnish luckily has distinct words for the two things: "luku" >(a quantity) and "numero" (a digit, numeral or label): > > luonnollinen luku (natural number) > kokonaisluku (integer) > rationaaliluku(ra

Re: Integers with leading zeroes

2015-07-22 Thread Marko Rauhamaa
Ben Finney : > Despite that they are represented in text with digits, and the > authority that generates them may even use some sequence of integers, > the types should not be treated as numbers. Let's just say that the word "number" has multiple meanings. Words with many meanings often lead to c

Re: Integers with leading zeroes

2015-07-22 Thread alister
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

Re: Integers with leading zeroes

2015-07-22 Thread Ben Finney
Laura Creighton writes: > 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'. The following are examples of types from the real world that peo

Re: Integers with leading zeroes

2015-07-22 Thread Laura Creighton
I wonder if bitcoin miners and other cryptological users need the leading 0s. Laura -- https://mail.python.org/mailman/listinfo/python-list

Re: Integers with leading zeroes

2015-07-22 Thread Laura Creighton
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

Re: Address field [was: Integers with leading zeroes]

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 2:31 PM, Jason Friedman wrote: >> Of course, most of the >> time, I advocate a single multi-line text field "Address", and let >> people key them in free-form. No postcode field whatsoever. > > I'm curious about that statement. > I could see accepting input as you describe

Address field [was: Integers with leading zeroes]

2015-07-21 Thread Jason Friedman
> Of course, most of the > time, I advocate a single multi-line text field "Address", and let > people key them in free-form. No postcode field whatsoever. I'm curious about that statement. I could see accepting input as you describe above, but I'm thinking you'd want to *store* a postcode field.

Re: Integers with leading zeroes

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 12:14 PM, Steven D'Aprano wrote: > On Wed, 22 Jul 2015 11:10 am, Chris Angelico wrote: > >> On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano >> wrote: Sometimes these numbers represent codeblocks of a fixed number of digits. Always writing those numbers with thi

Re: Integers with leading zeroes

2015-07-21 Thread Steven D'Aprano
On Wed, 22 Jul 2015 11:10 am, Chris Angelico wrote: > On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano > wrote: >>> Sometimes these numbers represent codeblocks of a fixed >>> number of digits. Always writing those numbers with this >>> number of digits helps being aware of this. It is also >>>

Re: Integers with leading zeroes

2015-07-21 Thread Chris Angelico
On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano wrote: >> Sometimes these numbers represent codeblocks of a fixed >> number of digits. Always writing those numbers with this >> number of digits helps being aware of this. It is also >> easier for when you need to know how many leading zero's >> s

Re: Integers with leading zeroes

2015-07-21 Thread Steven D'Aprano
On Wed, 22 Jul 2015 03:21 am, Antoon Pardon wrote: > On 07/19/2015 07:39 AM, Steven D'Aprano wrote: >> In Python 2, integer literals with leading zeroes are treated as octal, >> so 09 is a syntax error and 010 is 8. >> >> This is confusing to those not raised on C-style octal literals, so in >> P

Re: Integers with leading zeroes

2015-07-21 Thread sohcahtoa82
On Tuesday, July 21, 2015 at 11:38:53 AM UTC-7, sohca...@gmail.com wrote: > On Tuesday, July 21, 2015 at 11:07:43 AM UTC-7, Emile van Sebille wrote: > > On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote: > > > > > > IMO, leading zeroes just looks like visual noise, and if I wanted to > > > align

Re: Integers with leading zeroes

2015-07-21 Thread sohcahtoa82
On Tuesday, July 21, 2015 at 11:07:43 AM UTC-7, Emile van Sebille wrote: > On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote: > > > > IMO, leading zeroes just looks like visual noise, and if I wanted to align > > numbers, I'd just use spaces. > > > > Aligning numbers using spaces doesn't always

Re: Integers with leading zeroes

2015-07-21 Thread Emile van Sebille
On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote: IMO, leading zeroes just looks like visual noise, and if I wanted to align numbers, I'd just use spaces. Aligning numbers using spaces doesn't always align -- using zeros does. Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: Integers with leading zeroes

2015-07-21 Thread sohcahtoa82
On Tuesday, July 21, 2015 at 10:22:44 AM UTC-7, Antoon Pardon wrote: > On 07/19/2015 07:39 AM, Steven D'Aprano wrote: > > In Python 2, integer literals with leading zeroes are treated as octal, so > > 09 is a syntax error and 010 is 8. > > > > This is confusing to those not raised on C-style octal

Re: Integers with leading zeroes

2015-07-21 Thread Antoon Pardon
On 07/19/2015 07:39 AM, Steven D'Aprano wrote: > In Python 2, integer literals with leading zeroes are treated as octal, so > 09 is a syntax error and 010 is 8. > > This is confusing to those not raised on C-style octal literals, so in > Python 3 leading zeroes are prohibited in int literals. Octa

Re: Integers with leading zeroes

2015-07-19 Thread Rick Johnson
On Sunday, July 19, 2015 at 3:19:01 AM UTC-5, Skybuck Flying wrote: > 14324 > 234545 > 345 > 534543 > > ^ Looks less good though in non-fixed-sized font. The obvious solution is to use a fixed width font. If you're inserting syntactical noise simply to maintain readability in variable widt

Re: Integers with leading zeroes

2015-07-19 Thread Skybuck Flying
Don't be noob ? ;) Always remove leading zeroes ? One case that comes to mind is ASCII art like code... where programmer may want to align numbers for clearity: 0014324 0234545 345 0534543 ^ That could be a problem but possibly solveable with spaces instead: 14324 234545 345 534543

Re: Integers with leading zeroes

2015-07-18 Thread Ian Kelly
On Sat, Jul 18, 2015 at 11:39 PM, Steven D'Aprano wrote: > In Python 2, integer literals with leading zeroes are treated as octal, so > 09 is a syntax error and 010 is 8. > > This is confusing to those not raised on C-style octal literals, so in > Python 3 leading zeroes are prohibited in int lite

Integers with leading zeroes

2015-07-18 Thread Steven D'Aprano
In Python 2, integer literals with leading zeroes are treated as octal, so 09 is a syntax error and 010 is 8. This is confusing to those not raised on C-style octal literals, so in Python 3 leading zeroes are prohibited in int literals. Octal is instead written using the prefix 0o, similar to hex