(vals, attr, **kwargs)
Generate a list with all one the items' attributes' in <vals>. The attribute is specified as <attr>.
Generate a list with all one the items' attributes' in <vals>. The attribute is specified as <attr>.
Generate a list with all one the items attributes in <vals > . The attribute is specified as <attr > .
def list_from_attr(vals, attr, **kwargs):
    """Generate a list with all one the items' attributes' in <vals>. The attribute is specified as <attr>."""
    if 'default' in kwargs:
        return [v.get(attr, kwargs['default']) for v in vals]
    else:
        return [v[attr] for v in vals]
def list_from_attr ( vals , attr , * * kwargs ) : if 'default' in kwargs : return [ v . get ( attr , kwargs [ 'default' ] ) for v in vals ] else : return [ v [ attr ] for v in vals ]