Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'subject:Python': 0.05; 'content-type:multipart/signed': 0.09; 'filename:fname piece:signature': 0.09; '(do': 0.16; '(note:': 0.16; 'a2,': 0.16; 'antti': 0.16; 'content-type:application/pgp-signature': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname:signature.asc': 0.16; 'goto,': 0.16; 'phases.': 0.16; 'subject: \n ': 0.16; 'subject:Programming': 0.16; 'wrote:': 0.18; 'to:2**1': 0.21; 'header:In-Reply-To:1': 0.22; 'module': 0.26; 'import': 0.27; 'url:)': 0.29; 'goto': 0.30; 'actually': 0.31; 'header:User- Agent:1': 0.33; 'programming,': 0.34; 'all.': 0.34; 'algorithms': 0.34; 'end.': 0.34; 'to:addr:python-list': 0.35; 'something': 0.35; 'to:name:python-list': 0.37; 'another': 0.37; 'subject:with': 0.37; 'received:128': 0.38; 'received:192': 0.38; 'some': 0.38; 'several': 0.38; 'clearly': 0.39; 'to:addr:python.org': 0.40; 'more': 0.61; 'art': 0.61; 'subject:. ': 0.63; 'donald': 0.67; 'series': 0.67; 'presents': 0.71; 'divided': 0.73; 'phase': 0.82; 'knuth': 0.84; 'more).': 0.84; 'url:goto': 0.84 Date: Sat, 17 Mar 2012 21:59:31 -0500 From: Evan Driscoll User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Antti J Ylikoski , python-list Subject: Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct References: In-Reply-To: X-Enigmail-Version: 1.4 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9C55FFF1FB2BDE6E723C8B0D" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 74 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1332040943 news.xs4all.nl 6909 [2001:888:2000:d::a6]:35290 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21849 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9C55FFF1FB2BDE6E723C8B0D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 3/17/2012 9:03, Antti J Ylikoski wrote: >=20 > In his legendary book series The Art of Computer Programming, > Professor Donald E. Knuth presents many of his algorithms in the form > that they have been divided in several individual phases, with > instructions to GOTO to another phase interspersed in the text of the > individual phases. >=20 >=20 > A1. (Do the work of Phase A1.) If then go to Phase A5, > otherwise continue. >=20 > A2. (Do some work.) If go to Phase A4. >=20 > A3. (Some more work.) >=20 > A4. (Do something.) If go to Phase A1. >=20 > A5. (Something more). If then go to Phase A2, otherwise > end. Clearly you just need the goto module (http://entrian.com/goto/): from goto import goto, label label .A1 # do work of phase A1 if : goto .A5 label .A2 # do some work if : goto .A4 # do some more work label .A4 # do something if : goto .A1 label .A5 # something more if : goto .A2 Clearly the best solution of all. (Note: do not actually do this.) Evan --------------enig9C55FFF1FB2BDE6E723C8B0D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPZU+ZAAoJEAOzoR8eZTzgx6YH/1r43y6XWZixjFMgw8w4KFrO gQdYN1sB/sjfjkMnqf8QmN7GKAlXWe9QxuqqqIB1E7dqNrIYwLgbhM2KaQe72huU NSAlpSjbBeZNYnpZOYE0ITGQxKfpHV+b82FAGUYHMOoK4uJEpUQhmE5FBMW/+T82 3AF+mNSJddDbP/qEUv8x9BSjPuzl4NuC4Q1epnYJU7WQySvg4OM+UWDENaTEGTtq VDYUDRRkbjHnZ0iSA9YLge44yehdHchAx+K6DKvnmwSHsD8Ozsy2z3gRbG2nd1Rq 0EBesNyYYlsJOUPJyec2BLw4AXGK9MfIbu38JHeS1lxPxuoMtBK++TlJuYkWGAk= =Gb8C -----END PGP SIGNATURE----- --------------enig9C55FFF1FB2BDE6E723C8B0D--