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