RE: A problem with str VS int.

2023-12-12 Thread AVI GROSS via Python-list
y, December 12, 2023 3:58 AM To: [email protected] Subject: Re: A problem with str VS int. Op 12/12/2023 om 9:22 schreef Steve GS via Python-list: > With all these suggestions on > how to fix it, no one seems to > answer why it fails only when > entering a two-digit number. > O

Re: A problem with str VS int.

2023-12-12 Thread dn via Python-list
On 12/12/23 21:22, Steve GS wrote: With all these suggestions on how to fix it, no one seems to answer why it fails only when entering a two-digit number. One and three work fine when comparing with str values. It is interesting that the leading 0 on a two digit worked. Still, one digit and thre

Re: A problem with str VS int.

2023-12-12 Thread Roel Schroeven via Python-list
Op 12/12/2023 om 9:22 schreef Steve GS via Python-list: With all these suggestions on how to fix it, no one seems to answer why it fails only when entering a two-digit number. One and three work fine when comparing with str values. It is interesting that the leading 0 on a two digit worked. Stil

RE: A problem with str VS int.

2023-12-12 Thread Steve GS via Python-list
now more of a curiosity as I did use the integer comparisons. SGA -Original Message- From: Python-list On Behalf Of dn via Python-list Sent: Sunday, December 10, 2023 12:53 AM To: [email protected] Subject: Re: A problem with str VS int. On 10/12/23 15:42, Steve GS via Python-list

Re: A problem with str VS int.

2023-12-09 Thread dn via Python-list
On 10/12/23 15:42, Steve GS via Python-list wrote: If I enter a one-digit input or a three-digit number, the code works but if I enter a two digit number, the if statement fails and the else condition prevails. tsReading = input(" Enter the " + Brand + " test strip reading: ")

Re: A problem with str VS int.

2023-12-09 Thread Thomas Passin via Python-list
On 12/9/2023 9:42 PM, Steve GS via Python-list wrote: If I enter a one-digit input or a three-digit number, the code works but if I enter a two digit number, the if statement fails and the else condition prevails. tsReading = input(" Enter the " + Brand + " test strip reading: ")

RE: A problem with str VS int.

2023-12-09 Thread AVI GROSS via Python-list
user can enter any text, they might enter ".01" or "hello" or al kinds of nonsense. If you converted to numbers and tested whether it failed, ... -Original Message- From: Python-list On Behalf Of Steve GS via Python-list Sent: Saturday, December 9, 2023 9:42 PM To: pyth

A problem with str VS int.

2023-12-09 Thread Steve GS via Python-list
If I enter a one-digit input or a three-digit number, the code works but if I enter a two digit number, the if statement fails and the else condition prevails. tsReading = input(" Enter the " + Brand + " test strip reading: ") if tsReading == "": tsReading = "0" print(t

Re: problem with str()

2007-03-16 Thread Steve Holden
Alex Martelli wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: >... Get yourself a stuffed bear, and next time you have this kind of problem spend a few minutes explaining to the bear exactly how your program can't possibly be wrong. Works like a charm. >>> A rubber ducky works m

Re: problem with str()

2007-03-15 Thread Petr Prikryl
"Alex Martelli" wrote > Steve Holden wrote: >... > > >> Get yourself a stuffed bear, and next time you have this kind of problem > > >> spend a few minutes explaining to the bear exactly how your program > > >> can't possibly be wrong. Works like a charm. > > > > > > A rubber ducky works muc

Re: problem with str()

2007-03-15 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: ... > >> Get yourself a stuffed bear, and next time you have this kind of problem > >> spend a few minutes explaining to the bear exactly how your program > >> can't possibly be wrong. Works like a charm. > > > > A rubber ducky works much better for that,

Re: problem with str()

2007-03-15 Thread 7stud
On Mar 15, 5:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The fact that a list comprehension "leaks" its variables into the > containing scope is a bit weird. > A generator expression doesn't: > > py> str > > py> w = (str for str in range(10)) > py> w > > py> str > > py> w.next() >

Re: problem with str()

2007-03-15 Thread Steve Holden
Alex Martelli wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: > >> 7stud wrote: >>> Sheesh! You would think that after looking at every inch of the code >>> for way too many hours, at some point that would have poked me in the >>> eye. >>> >>> Thanks all. >>> >> Get yourself a stuffed bear, and n

Re: problem with str()

2007-03-15 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > Sheesh! You would think that after looking at every inch of the code > > for way too many hours, at some point that would have poked me in the > > eye. > > > > Thanks all. > > > Get yourself a stuffed bear, and next time you have this ki

Re: problem with str()

2007-03-15 Thread Paul Rubin
[EMAIL PROTECTED] writes: > methodList = [str for str in names if callable(getattr(obj, str))] > > instead, do something like this: > > methodList = [i for i in names if callable(getattr(obj, i))] or: methodList = list(str for str in names if callable(getattr(obj, str))) genexps, unlike lis

Re: problem with str()

2007-03-15 Thread Gabriel Genellina
En Thu, 15 Mar 2007 17:32:24 -0300, <[EMAIL PROTECTED]> escribió: > methodList = [str for str in names if callable(getattr(obj, str))] > > instead, do something like this: > > methodList = [i for i in names if callable(getattr(obj, i))] The fact that a list comprehension "leaks" its variables int

Re: problem with str()

2007-03-15 Thread Steve Holden
7stud wrote: > Sheesh! You would think that after looking at every inch of the code > for way too many hours, at some point that would have poked me in the > eye. > > Thanks all. > Get yourself a stuffed bear, and next time you have this kind of problem spend a few minutes explaining to the bear

Re: problem with str()

2007-03-15 Thread 7stud
Sheesh! You would think that after looking at every inch of the code for way too many hours, at some point that would have poked me in the eye. Thanks all. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with str()

2007-03-15 Thread Terry Reedy
"7stud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I can't get the str() method to work in the following code(the last | line produces an error): If you 'print str' here | methodList = [str for str in names if callable(getattr(obj, str))] and again here, you will see the prob

Re: problem with str()

2007-03-15 Thread kyosohma
On Mar 15, 2:49 pm, "7stud" <[EMAIL PROTECTED]> wrote: > I can't get the str() method to work in the following code(the last > line produces an error): > > > class test: > """class test""" > def __init__(self): > """I am init func!""" > s

Re: problem with str()

2007-03-15 Thread Larry Bates
7stud wrote: > I can't get the str() method to work in the following code(the last > line produces an error): > > > class test: > """class test""" > def __init__(self): > """I am init func!""" > self.num = 10 > self.num2

Re: problem with str()

2007-03-15 Thread Matimus
Don't use built-ins as variable names. Your code will work if you change this: > methodList = [str for str in names if callable(getattr(obj, str))] to this: > methodList = [s for s in names if callable(getattr(obj, s))] -- http://mail.python.org/mailman/listinfo/python-list

problem with str()

2007-03-15 Thread 7stud
I can't get the str() method to work in the following code(the last line produces an error): class test: """class test""" def __init__(self): """I am init func!""" self.num = 10 self.num2 = 20 def someFunc(self):