Re: [Tutor] string rules for 'number'

2012-10-08 Thread Oscar Benjamin
On 8 October 2012 03:19, eryksun wrote: > As a supplement to what's already been stated about string > comparisons, here's a possible solution if you need a more 'natural' > sort order such as '1', '5', '10', '50', '100'. > > You can use a regular expression to split the string into a list of > (d

Re: [Tutor] string rules for 'number'

2012-10-08 Thread Steven D'Aprano
On 08/10/12 11:51, Arnej Duranovic wrote: Alright guys, I appreciate all your help SO much. I know understand, as the gentleman above said " A string is a string is a string" doesn't matter what is in it and they are ordered the same way...BUT this is what was going through my head. Since letters

Re: [Tutor] string rules for 'number'

2012-10-07 Thread eryksun
On Sun, Oct 7, 2012 at 1:46 PM, Arnej Duranovic wrote: > > When I type this in the python idle shell ( version 3...) : > '0' <= '10' <= '9' > The interpreter evaluates this as true, WHY? 10 is greater than 0 but not 9 > Notice I am not using the actual numbers, they are strings...I tho

Re: [Tutor] string rules for 'number'

2012-10-07 Thread Arnej Duranovic
Alright guys, I appreciate all your help SO much. I know understand, as the gentleman above said " A string is a string is a string" doesn't matter what is in it and they are ordered the same way...BUT this is what was going through my head. Since letters are ordered in such a way that A is less th

Re: [Tutor] string rules for 'number'

2012-10-07 Thread Steven D'Aprano
On 08/10/12 05:20, Mark Lawrence wrote: [...] They'll be compared lexicographically, something I'm not inclined to attempt to explain so see here http://en.wikipedia.org/wiki/Lexicographical_order Please also be careful with your terminology. Note that I've used compared. Ordered is very diff

Re: [Tutor] string rules for 'number'

2012-10-07 Thread Steven D'Aprano
On 08/10/12 04:46, Arnej Duranovic wrote: When I type this in the python idle shell ( version 3...) : '0'<= '10'<= '9' The interpreter evaluates this as true, WHY? 10 is greater than 0 but not 9 Notice I am not using the actual numbers, they are strings...I thought that numbers being

Re: [Tutor] string rules for 'number'

2012-10-07 Thread Mark Lawrence
On 07/10/2012 18:46, Arnej Duranovic wrote: When I type this in the python idle shell ( version 3...) : '0' <= '10' <= '9' The interpreter evaluates this as true, WHY? 10 is greater than 0 but not 9 Notice I am not using the actual numbers, they are strings...I thought that numbers b

Re: [Tutor] string rules for 'number'

2012-10-07 Thread boB Stepp
On Oct 7, 2012 12:47 PM, "Arnej Duranovic" wrote: > > When I type this in the python idle shell ( version 3...) : > '0' <= '10' <= '9' > The interpreter evaluates this as true, WHY? 10 is greater than 0 but not 9 Since they are strings it looks at these character by character. Since '

Re: [Tutor] string rules for 'number'

2012-10-07 Thread Joel Goldstick
On Sun, Oct 7, 2012 at 1:46 PM, Arnej Duranovic wrote: > When I type this in the python idle shell ( version 3...) : > '0' <= '10' <= '9' > The interpreter evaluates this as true, WHY? 10 is greater than 0 but not 9 > Notice I am not using the actual numbers, they are strings...I thoug

[Tutor] string rules for 'number'

2012-10-07 Thread Arnej Duranovic
When I type this in the python idle shell ( version 3...) : '0' <= '10' <= '9' The interpreter evaluates this as true, WHY? 10 is greater than 0 but not 9 Notice I am not using the actual numbers, they are strings...I thought that numbers being string were ordered by their numerical val