Postpone evaluation of argument
no.email at nospam.invalid
Fri Feb 10 18:57:56 EST 2012
Righard van Roy <pluijzer at gmail.com> writes:
> I want to add an item to a list, except if the evaluation of that item
> results in an exception.
This may be overkill and probably slow, but perhaps most in the spirit
that you're asking.
from itertools import chain
if x > 3:
def p(i): return maybe(lambda: r(i))
your_list = list(chain(p(1), p(5)))
More information about the Python-list