#!/usr/local/bin/python2 for v in [1,2,3]: if v is not None: break print v print next((v for v in [1,2,3] if v is not None), None)