Orri Ganel said unto the world upon 01/04/06 03:04 PM: > Brian van den Broek wrote:
<snip> >> Then, the output is like so: >> >> >>> atoms = ["a","b","c"] >> >>> tvas = tva_dict_maker(atoms) >> >>> display_tvas(tvas) >> a:True b:True c:True >> a:True b:True c:False >> a:True b:False c:True >> a:True b:False c:False >> a:False b:True c:True >> a:False b:True c:False >> a:False b:False c:True >> a:False b:False c:False >> >>> <snip> > What this shouts immediately to me, at least, is binary numbers and > bool(). Just use your favorite binary conversion recipe, and count down > from int(len(atoms)*"1",2), converting as you go. And then you take the > boolean value of each digit of the binary number. If you need help, let > me know as I've completed a working model. > > HTH, > Orri Hi Orri, thanks for the suggestion, and apologies for the delayed response. I absolutely agree that the problem is connected to binary representations of integers as you suggest. The problem -- given my needs -- with your suggested approach is in "use your favo[u*]rite binary conversion recipe". I want my code to be stand alone and I feel fairly safe in asserting that if I implemented your suggestion in a self-contained chunk of code, I'd end up with something more complex than the code I originally posted. In effect, my original code exploited the same principle, without actually going through the binary representation. I am of course open to the possibility that my suspicion is ill-grounded ;-) But, thanks! Best, Brian vdB [*] I'm Canadian, eh! ;-) _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor