DISQUS

Phil Dawes' Stuff: sparta & my ideal python/rdf api

  • Ben · 2 years ago
    This would seem to be a good match for descriptors... Make property a descriptor which checks maxCardinality, if it's 1 return the property, if it's more return a generator. The __set__ on the descriptor could take care of setting the property..
    The only thing I can see which might cause problems is presenting a consistent API, i.e. how are you supposed to know that it's a generator as opposed to a value/object/whatever gets returned.