Writing Donald E. Knuth based code in Python, cont'd
Vincent Vande Vyvre
vincent.vandevyvre at swing.be
Mon Nov 12 23:01:56 CET 2012
Le 12/11/12 22:02, Juhani Ylikoski a écrit :
> Following comes a working, debugged Python program which computes the
> permutations of the integers 1, 2, 3 - n after Donald E. Knuth. I
> present it as an example of writing straightforward, easy Knuth-based
> code in a language with no GOTO statement.
> The Python program has been written after the DFA construct I
> previously discussed in this newsgroup, and after Knuth's discussion
> of the solution of the problem; and according the (very good)
> discussions in this newsgroup. To my opinion, it no more is a "crow's
> nest" as they say in Finnish.
> This program was needed for a real problem, namely computing optimal
> tournament tables for a Bughouse (Tandem) chess tournament. See
> Knuth became criticized in the newsgroup; but to my opinion his books
> are still useful and nontrivially needed.
> yours sincerely, Antti J Ylikoski
> Helsinki, Finland
> PhD student in the Aalto University
One comment in:
def E1(self): # Phase 1 in Knuth's text
self.app = self.listofPerm.append(self.a[1:self.n+1])
return self.E2 # next state: E2
append() return None and self.app is no longer used in the code.
Missing something ?
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>
More information about the Python-list