Hello,<div><br></div><div>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.</div>
<div><br></div><div>class ISudoku:</div><div><br></div><div> board = Attribute()</div><div><br></div><div> def free(col, line):</div><div> "frees the slot at position col, line" </div><div><br></div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div> def set(col, line, value):</div><div> "Sets the value in the slot at position col, line" </div></div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
def candidates(col, line):</div><div> "Returns the candidate digits for the slot at position col,line" </div></div><div><br></div><div><br></div><div>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). </div>
<div><br></div><div>Thank you for your help,</div><div><br></div><div><br></div><div>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).</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>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.</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div> </div><meta http-equiv="content-type" content="text/html; charset=utf-8">