Re: [Tutor] Do you use unit testing?

2009-11-16 Thread Jeff R. Allen
> As a discipline - work out what we want to test, write the test, watch > it fail, make it pass - I find this a very productive way to think and > work. There's an emotional aspect too. Keeping a positive aspect keeps up flow, and seeing tests go from failing to passing feels really good. Making

Re: [Tutor] Unexpected Result in Test Sequence

2009-11-16 Thread Jeff R. Allen
When you declare list1 before "def p()" you are making it global. That means it will keep its values between invocations of p(). When you start function p, you don't reset list1 to empty. You divide each time by 1000, and but your list1 list is growing and growing and growing. That's why the total

Re: [Tutor] How to call a method with a print statement?

2009-11-12 Thread Jeff R. Allen
You are looking for the __str__ method. See http://docs.python.org/reference/datamodel.html#object.__str__ class Foo():   def __init__(self):      pass   def  __str__(self)      return "hello world!" -jeff ___ Tutor maillist - Tutor@python.org To u

[Tutor] Unexpected iterator

2009-11-12 Thread Jeff R. Allen
Hello, I am working my way through the tutorial, and I like trying variations, just to see what expected errors look like, and other ways things could be written. I tried a, b = 0, 0 and that worked. Then I tried this to (maybe) set both a and b to 0: >>> a, b = 0 Traceback (most recent call la