Commits

prencher  committed 4a4c583

Optimize `__contains__`, should now be constant time.

  • Participants
  • Parent commits fd77de0

Comments (0)

Files changed (1)

File wtforms/form.py

             yield field
 
     def __contains__(self, item):
-        for name, field in self._fields:
-            if name == item:
-                return True
+        return getattr(getattr(self, item, False), '_formfield', False) is True
 
     def __delattr__(self, name): 
         try: