Re: [Tutor] unwanted 'zero' ending

2013-07-10 Thread Fábio Santos
On 28 Jun 2013 08:33, "Peter Otten" <__pete...@web.de> wrote: > > Whatever approach you pick, unittest, doctest, or a combination, your code > will improve -- not just because you are verifying its correctness to some > extent, but also because the inherent question "How can I test it?" will > lead

Re: [Tutor] Data persistence problem

2013-06-23 Thread Fábio Santos
On 21 Jun 2013 07:36, "Arijit Ukil" wrote: > > I have following random number generation function > > def rand_int (): > rand_num = int(math.ceil (random.random()*1000)) > return rand_num > > I like to make the value of rand_num (return of rand_int) static/ unchanged after first call even

Re: [Tutor] How to find descendants recursively?

2013-06-23 Thread Fábio Santos
: print(('-' * dash_count) + str(item)) children = get_children(item) # also returns a generator if children: recurse_items(children, dash_count + 1) recurse_items(items) I added a "dash_count" to the mix, so you can see an example of how to