Hello,

I have two objects which interoperate to solve a sudoku: the Sudoku class
and a vector (a list actually) of generator functions. The Sudoku interface
is simple to write as it requires three functions and an attribute.

class ISudoku:

    board = Attribute()

    def free(col, line):
        "frees the slot at position col, line"

    def set(col, line, value):
        "Sets the value in the slot at position col, line"

    def candidates(col, line):
        "Returns the candidate digits for the slot at position col,line"


But how to express "vector of generator functions" with Zope interfaces? I
want to express the possibility to access the vector object with
the  [n] index notation, and this returns a function returning a generator
(an object with an iter and next function).

Thank you for your help,


PS: the vector of generator functions is the input of the algorithm called
"conjoin", used to solve the eight queen problem and knight's tour problem.
It is described in the Python sources
(Python-2.6.5/Lib/test/test_generators.py).

PPS: I say vector instead of list even when the vector is a list, because
"list" usually  implies the possibility to append elements dynamically which
is not pertinent in this problem. The length of the vector won't change and
is equal to the number of slots on a sudoku board.
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to