Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Checking if nested list is essentially empty

📅 2009-Oct-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Also see: http://stackoverflow.com/questions/1593564

# Note: all([]) returns True

def isListEmpty(inList):
    if isinstance(inList, list):    # Is a list
        return all( map(isListEmpty, inList) )
    return False # Not a list