Mike Meyer <[EMAIL PROTECTED]> writes:
> Personally, I'd love a language feature that let you create a function
> that didn't evaluate arguments until they were actually used - lazy
> evaluation. That lets you write the C ?: operator as a function, for
> a start.
> 
> Hmmm. No, iterators can't be used to fake it. Oh well.

You can fake it with lambda, but the syntax is contorted.

    a = condition ? expr1 : expr2;

becomes

    a = ((lambda: expr2, lambda: expr1)[bool(condition)])()
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to