Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Brian van den Broek
Danny Yoo said unto the world upon 06/04/06 04:38 PM: > Yes, I agree that the readability of the code is primary. Understandng > the recursive approach depends on the reader's comfort with recursive > functions, and the non-recursive code depends on the reader's comfort with > arithmetic operat

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Danny Yoo
> One way to get rid of the 'recursed' flag is to refactor slightly, and > break out the sorting in another helper function, like this: > > ## > def tva_dict_maker(atoms): > tvas = tiva_helper(atoms) ^^^ >

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Danny Yoo
> Your post got me to take another bash and I obtained a recursive > solution. But, subject to the caveat that my recursive solution might > well be non-optimal, the non-recursive approach seems a bit better to > me. Opinions welcome :-) > > My recursive solution: > > def recursive_tva_dict_maker(a

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Brian van den Broek
Orri Ganel said unto the world upon 01/04/06 03:04 PM: > Brian van den Broek wrote: >> Then, the output is like so: >> >> >>> atoms = ["a","b","c"] >> >>> tvas = tva_dict_maker(atoms) >> >>> display_tvas(tvas) >> a:Trueb:Truec:True >> a:Trueb:Truec:False >> a:Trueb:Fals

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Brian van den Broek
Danny Yoo said unto the world upon 31/03/06 08:27 PM: > >>Then, the output is like so: >> >> >>> atoms = ["a","b","c"] >> >>> tvas = tva_dict_maker(atoms) >> >>> display_tvas(tvas) >>a:Trueb:True c:True >>a:Trueb:True c:False >>a:Trueb:False c:True >>a:Trueb:False

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-01 Thread Orri Ganel
Brian van den Broek wrote: >Hi all, > >I've been too busy with life to do much Python of late. So, I am a bit >rusty. :-( > >I've got some code that does what it needs to but I think I might be >overlooking a much smoother way to get what I need. > >The code takes a list of strings and returns a

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-03-31 Thread Danny Yoo
> Then, the output is like so: > > >>> atoms = ["a","b","c"] > >>> tvas = tva_dict_maker(atoms) > >>> display_tvas(tvas) > a:Trueb:True c:True > a:Trueb:True c:False > a:Trueb:False c:True > a:Trueb:False c:False > a:False b:True c:True > a:False

[Tutor] request for sugestions on fragement of code for generating truth-tables

2006-03-31 Thread Brian van den Broek
Hi all, I've been too busy with life to do much Python of late. So, I am a bit rusty. :-( I've got some code that does what it needs to but I think I might be overlooking a much smoother way to get what I need. The code takes a list of strings and returns a list of dictionaries, where each dic