Skip to content

Instantly share code, notes, and snippets.

View dound's full-sized avatar

David Underhill dound

View GitHub Profile
from google.appengine.ext import db
class ChoiceProperty(db.IntegerProperty):
"""A property for efficiently storing choices made from a finite set.
This works by mapping each choice to an integer. The choices must be hashable
(so that they can be efficiently mapped back to their corresponding index).
Example usage: