Andreas' practical language comparison

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John J. Lee

    #16
    Re: Andreas' practical language comparison

    Andrea Griffini <agriff@tin.i t> writes:
    [color=blue]
    > On Sun, 25 Apr 2004 22:46:48 +0200, "GerritM" <gmuller@worldo nline.nl>
    > wrote:[/color]
    [...][color=blue]
    > I'm very new to python, but anyway this is my solution to 8
    > queen's problem:[/color]
    [...]

    I think there's an n-queens solution by Tim Peters somewhere, written
    as an example of Python simple generators (which is mostly 'his'
    language feature, IIRC).


    John

    Comment

    • Peter Hansen

      #17
      Re: Andreas' practical language comparison

      John J. Lee wrote:
      [color=blue]
      > I think there's an n-queens solution by Tim Peters somewhere, written
      > as an example of Python simple generators (which is mostly 'his'
      > language feature, IIRC).[/color]

      Google found a page which says:
      Two other examples in Lib/test/test_generators .py produce solutions
      for the N-Queens problem (placing queens on an chess board so that
      no queen threatens another) and the Knight's Tour (a route that takes
      a knight to every square of an chessboard without visiting any square
      twice).

      So I guess the answer would be "use the source".

      -Peter

      Comment

      • Terry Reedy

        #18
        Re: Andreas' practical language comparison

        > I think there's an n-queens solution by Tim Peters somewhere, written[color=blue]
        > as an example of Python simple generators (which is mostly 'his'
        > language feature, IIRC).[/color]

        It is in Lib/test/test_generators .py. It also has other examples of fancy
        footwork with generators . Anyone interested in the topic should read it.

        Terry J. Reedy




        Comment

        Working...