I could easily see using all of the examples;  I run into this pretty regularly.

What about something like the following (which, honestly is really a 
combination of other examples).

If I have a function that has multiple parameters, each of which might be 
expensive, but it might break out earlier depending on how each one is 
evaluated... for example:

(pretending that "$" is a flag that says "evaluate later", and $(arg) is how 
you say "evaluate now")

def combine_unless_none(*$args, sep=', '):
    """ if any arg evaluates to None, return '', otherwise join"""
    for arg in args:
        tmp_arg = $(arg)
        If tmp_arg is None:
            return "
    return sep.join(args)


Reply via email to