Re: We have string.isdigit(), why not string.isNumber()?

2008-04-30 Thread Ben Finney
MooMaster <[EMAIL PROTECTED]> writes: > I know how to write a regexp or method or whatever to do this, my main > question is *why* something like an isNumber() method is not baked > into the class. Because that name wouldn't conform to PEP 8. (Also, and more importantly, because it's more correc

Re: We have string.isdigit(), why not string.isNumber()?

2008-04-30 Thread Dan Bishop
On Apr 30, 7:56 pm, MooMaster <[EMAIL PROTECTED]> wrote: > N00b question alert! I did a search for isdigit() in the group > discussion, and it didn't look like the question had been asked in the > first 2 pages, so sorry if it was... > > The manual documentation says: > "isdigit( ) > > Return true

Re: We have string.isdigit(), why not string.isNumber()?

2008-04-30 Thread Roy Smith
In article <[EMAIL PROTECTED]>, MooMaster <[EMAIL PROTECTED]> wrote: > So it makes sense that something like 5.6 would return false. But what > if we want to make sure that our string is a valid number, ie decimals > included? Just call int(x) or float(x) inside a try block and see if if it rai

We have string.isdigit(), why not string.isNumber()?

2008-04-30 Thread MooMaster
N00b question alert! I did a search for isdigit() in the group discussion, and it didn't look like the question had been asked in the first 2 pages, so sorry if it was... The manual documentation says: "isdigit( ) Return true if all characters in the string are digits and there is at least one ch