import fnmatch


def _get_pprint_include_names(table):
    """Get the set of names to show in pprint from the table pprint_include_names
    and pprint_exclude_names attributes.

    These may be fnmatch unix-style globs.
    """
    def get_matches(name_globs, default):
        match_names = set()
        if name_globs:  # For None or () use the default
            for name in table.colnames:
                for name_glob in name_globs:
                    if fnmatch.fnmatch(name, name_glob):
                        match_names.add(name)
                        break
        else:
            match_names.update(default)
        return match_names

    include_names = get_matches(table.pprint_include_names(), table.colnames)
    exclude_names = get_matches(table.pprint_exclude_names(), [])

    return include_names - exclude_names