google/appengine/db/__init__.py starting at line 401 is:
if self.choices:
match = False
for choice in self.choices:
if choice == value:
match = True
if not match:
raise BadValueError('Property %s is %r; must be one of %r' %
(self.name, value,
self.choices))
It could be:
if value not in (self.choices or (value,)):
raise BadValueError('Property %s is %r; must be one of %r' %
(self.name, value,
self.choices))
"not in" will stop when it finds a match and may be faster for each
element checked.
Note that making self.choices a set would make the "not in" test O(1).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---