Re: [Tutor] assert() question

2008-07-06 Thread Dick Moores
At 02:30 PM 7/6/2008, Kent Johnson wrote: On Sun, Jul 6, 2008 at 2:49 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > I have a module, mycalc.py, which is a collection of functions designed to > be imported independently. > > I've heard about using assert() to check up on whether things are still >

Re: [Tutor] assert() question

2008-07-06 Thread Kent Johnson
On Sun, Jul 6, 2008 at 2:49 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > I have a module, mycalc.py, which is a collection of functions designed to > be imported independently. > > I've heard about using assert() to check up on whether things are still > working correctly, or something like that. S

Re: [Tutor] assert() question

2008-07-06 Thread Dick Moores
At 06:01 AM 7/6/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote Traceback (most recent call last): File "E:\PythonWork\Untitled 2.py", line 42, in assert(fact(10,4) == 3.629e+6) AssertionError I'm not sure but I suspect you are running into the dreaded floating point pre

Re: [Tutor] assert() question

2008-07-06 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote Traceback (most recent call last): File "E:\PythonWork\Untitled 2.py", line 42, in assert(fact(10,4) == 3.629e+6) AssertionError I'm not sure but I suspect you are running into the dreaded floating point precision problem. You probably need to

Re: [Tutor] assert() question

2008-07-06 Thread Dick Moores
At 01:23 AM 7/6/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote I've heard about using assert() to check up The top three work silently, but I found that I could not figure out how to use assert() with the functions that print rather than return. E.g., maxDiffBetPrimes() and prin

Re: [Tutor] assert() question

2008-07-06 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote I've heard about using assert() to check up The top three work silently, but I found that I could not figure out how to use assert() with the functions that print rather than return. E.g., maxDiffBetPrimes() and printTime(). Is there a way? Thats an

[Tutor] assert() question

2008-07-05 Thread Dick Moores
I have a module, mycalc.py, which is a collection of functions designed to be imported independently. I've heard about using assert() to check up on whether things are still working correctly, or something like that. So I've begun to write some assert() expressions(?)  and put them at the bottom

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Shivayogi, Sorry my last e-mail wasn't very helpful. Better would have been: >>> a=myClass() >>> b=myClass() >>> a.howmany() >>> myClass.count=0 >>> del a which will (hopefully) give you something like: Exception exceptions.AssertionError: in > ignored Assert is commonly used as a sanity

Re: [Tutor] assert

2005-12-23 Thread Kent Johnson
shivayogi kumbar wrote: > sir, >I would like to know about 'asser't keyword how it works in the > fallowing program I'm not sure what the question is. Do you not understand assert at all or is there something about how this program works that you don't understand? assert is documented here:

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Try this: >>>a=myClass() >>>b=myClass() >>>a.howmany() >>>a.count=0 >>>del a Does this help clear things up? Todd Maynard On Friday 23 December 2005 06:18, shivayogi kumbar wrote: > class myClass: >                         count = 0 >                          def __init__(self): >            

[Tutor] assert

2005-12-23 Thread shivayogi kumbar
sir, I would like to know about 'asser't keyword how it works in the fallowing program class myClass: count = 0 def __init__(self): myClass.count = myClass.count + 1 def __del_