[Dev] DRAFT: Python Schema API proposal

Alec Flett alecf at osafoundation.org
Fri Apr 15 15:49:06 PDT 2005


I've seen the "schema.One()" syntax around a few times since PyCon, and 
there's always been something that bothers me slightly about it. I think 
what it comes down to is that you're almost always defining "one" of 
something - and the rest of the time is divided between lists and dicts.

What about turning this syntax on its head and saying
class ....:
body = Types.Lob(displayName = "body", doc="whee", cardinality=schema.One)

(where of course, cardinality would default to One)

On a related note, having reasonable defaults for things is really 
important.. for instance, it would be really nice if the displayName 
actually defaulted to the name, in case you didn't define one.

It just seems like this simplifies simple single-cardinality instances 
to something really easy:

body = Types.Lob()

But otherwise... I love this proposal. I can't wait to use it...

Alec



More information about the Dev mailing list