def define_elements(table, namespace):
    """
    Define external variables for each element in namespace. Elements
    are defined both by name and by symbol.

    This is called from *__init__* as::

        elements = core.default_table()
        __all__  += core.define_elements(elements, globals())

    :Parameters:
         *table* : PeriodicTable
             Set of elements
         *namespace* : dict
             Namespace in which to add the symbols.
    :Returns: [string, ...]
        A sequence listing the names defined.

    .. Note:: This will only work for *namespace* globals(), not locals()!
    """
    names = {}
    for el in table:
        names[el.symbol] = el
        names[el.name] = el
    for el in [table.D, table.T]:
        names[el.symbol] = el
        names[el.name] = el
    for k, v in names.items():
        namespace[k] = v
    return list(names.keys())
