Re: [Zope-dev] an Interface expressing a list of generator function

2010-11-09 Thread Jim Fulton
On Tue, Nov 9, 2010 at 2:58 AM, Jean-Daniel jeandaniel.bro...@gmail.com wrote: Ok, If I attach an item_type to the the list, I do not think I will able to use the native Python list, and should use a subclass instead. It is a bit heavyweight, especially when the intent of the use of the

Re: [Zope-dev] an Interface expressing a list of generator function

2010-11-09 Thread Jean-Daniel
What exactly are you hoping to accomplish? In brief, I wish there were a concise and clear way to express that an object implements a list of generator functions, in the context of CS students learning the concept of interface. I am writing an article on a sudoku solver for an audience of CS

Re: [Zope-dev] an Interface expressing a list of generator function

2010-11-09 Thread Jean-Daniel
The end of the last message was not finished... Ideally, here is (maybe) what I wish I could write: from zope.interface import IList, IGenerator, implements, requires def make_generator_functions(): implements(IList(IGenerator)) [...] def stack_assumption(gen_funcs):

[Zope-dev] an Interface expressing a list of generator function

2010-11-08 Thread Jean-Daniel
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):

Re: [Zope-dev] an Interface expressing a list of generator function

2010-11-08 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/08/2010 04:40 AM, Jean-Daniel wrote: 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

Re: [Zope-dev] an Interface expressing a list of generator function

2010-11-08 Thread Jean-Daniel
Ok, If I attach an item_type to the the list, I do not think I will able to use the native Python list, and should use a subclass instead. It is a bit heavyweight, especially when the intent of the use of the interface was documentation. List and generators are very common in Python and are