Hi Chris, There are lots of situations where the same data structure should be used, and I think your suggestion would make them less reusable. For example in a book catalog you can have the same struture for Authors in both, the Book class and the Chapter class.
cheers, Gustavo. On Tue, May 3, 2011 at 1:36 PM, Chris Withers <[email protected]> wrote: > Hi All, > > We currently have to do: > > """ > class Friend(colander.TupleSchema): > rank = colander.SchemaNode(colander.Int(), > validator=colander.Range(0, 9999)) > name = colander.SchemaNode(colander.String()) > > class Friends(colander.SequenceSchema): > friend = Friend() > > class Person(colander.MappingSchema): > name = colander.SchemaNode(colander.String()) > age = colander.SchemaNode(colander.Int(), > validator=colander.Range(0, 200)) > friends = Friends() > """ > > It would feel much more natural to me to write the above as: > > class Person(colander.MappingSchema): > name = colander.SchemaNode(colander.String()) > age = colander.SchemaNode(colander.Int(), > validator=colander.Range(0, 200)) > > class friends(colander.SequenceSchema): > class friend(colander.TupleSchema): > rank = colander.SchemaNode( > colander.Int(), > validator=colander.Range(0, 9999) > ) > name = colander.SchemaNode(colander.String()) > > How do others feel about it? > > cheers, > > Chris > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > - http://www.simplistix.co.uk > > -- > You received this message because you are subscribed to the Google Groups > "pylons-devel" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pylons-devel?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.
