On Sep 21, 12:26 am, Gerardo Herzig <[EMAIL PROTECTED]> wrote:
> def collect_validators(self):
> v_dict = { 'is_really_a_number': is_really_a_number,
> 'is_even': is_even,
> 'is_greater_than_zero', is_greater_than_zero
> }
>
> for name, meth in v_dict.items():
> result = meth()
> if result: yield name
Are these validators actually methods rather than functions? If so,
you should write something like this:
def collect_validators(self):
methods = ['is_really_a_number', 'is_even',
'is_greater_than_zero']
return (m for m in methods if getattr(self, m)())
--
Paul Hankin
--
http://mail.python.org/mailman/listinfo/python-list