Re: how to check if a value is a floating point or not

2014-06-20 Thread Ian Kelly
On Fri, Jun 20, 2014 at 8:28 AM, Grant Edwards wrote: > On 2014-06-20, Mark Lawrence wrote: > >> For the OP a very important rule of thumb is never use a bare except, so >> this is right out. >> >> try: >> doSomething() >> except: >> WTF() > > IMO, that sort of depends on WTF() does. On

Re: how to check if a value is a floating point or not

2014-06-20 Thread alister
On Fri, 20 Jun 2014 14:28:52 +, Grant Edwards wrote: > On 2014-06-20, Mark Lawrence wrote: > >> For the OP a very important rule of thumb is never use a bare except, >> so this is right out. >> >> try: >> doSomething() >> except: >> WTF() > > IMO, that sort of depends on WTF() doe

Re: how to check if a value is a floating point or not

2014-06-20 Thread Grant Edwards
On 2014-06-20, Mark Lawrence wrote: > For the OP a very important rule of thumb is never use a bare except, so > this is right out. > > try: > doSomething() > except: > WTF() IMO, that sort of depends on WTF() does. One case where a bare except is well used is when stdandard output/er

Re: how to check if a value is a floating point or not

2014-06-20 Thread Mark Lawrence
On 20/06/2014 14:16, Sturla Molden wrote: Nicholas Cannon wrote: Guys i am only a beginner at python most of the stuff you are saying i need to do i dont understand. Then listen and try to learn :-) But don't use try/except everywhere! Some exceptions might be due to an error in your own co

Re: how to check if a value is a floating point or not

2014-06-20 Thread Sturla Molden
Nicholas Cannon wrote: > Guys i am only a beginner at python most of the stuff you are saying i > need to do i dont understand. Then listen and try to learn :-) In C it is customary to do all sorts of sanity checks in advance. Validating user input is an example. We can call this "to ask permis

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ian Kelly
On Fri, Jun 20, 2014 at 12:14 AM, Nicholas Cannon wrote: > Guys i am only a beginner at python most of the stuff you are saying i need > to do i dont understand. All we're saying is that the simplest and most accurate way to determine whether a string can be converted to an int or a float is to

Re: how to check if a value is a floating point or not

2014-06-19 Thread Nicholas Cannon
Guys i am only a beginner at python most of the stuff you are saying i need to do i dont understand. -- https://mail.python.org/mailman/listinfo/python-list

Re: how to check if a value is a floating point or not

2014-06-19 Thread Sturla Molden
wrote: > I am making a calculator and i need it to support floating point values > but i am using the function isnumeric to check if the user has entered an > int value. I need the same for floating point types so i could implement > an or in the if statement that checks the values the user has en

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ian Kelly
On Thu, Jun 19, 2014 at 1:23 AM, Ian Kelly wrote: > On Thu, Jun 19, 2014 at 12:48 AM, Nicholas Cannon > wrote: >> On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote: >>> I am making a calculator and i need it to support floating point values but >>> i am using the function isnume

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ian Kelly
On Thu, Jun 19, 2014 at 12:48 AM, Nicholas Cannon wrote: > On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote: >> I am making a calculator and i need it to support floating point values but >> i am using the function isnumeric to check if the user has entered an int >> value. I n

Re: how to check if a value is a floating point or not

2014-06-19 Thread Ben Finney
Nicholas Cannon writes: > #checks if the user input is an integer value > def checkint(a): > if a.isnumeric(): > return True > else: > if a.isalpha(): > return False > else: > return True What code

Re: how to check if a value is a floating point or not

2014-06-18 Thread Nicholas Cannon
On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote: > I am making a calculator and i need it to support floating point values but i > am using the function isnumeric to check if the user has entered an int > value. I need the same for floating point types so i could implement an o

Re: how to check if a value is a floating point or not

2014-06-18 Thread Gary Herron
On 06/18/2014 10:53 PM, nicholascann...@gmail.com wrote: I am making a calculator and i need it to support floating point values but i am using the function isnumeric to check if the user has entered an int value. I need the same for floating point types so i could implement an or in the if st

how to check if a value is a floating point or not

2014-06-18 Thread nicholascannon1
I am making a calculator and i need it to support floating point values but i am using the function isnumeric to check if the user has entered an int value. I need the same for floating point types so i could implement an or in the if statement that checks the values the user has entered and all