# 9 PEP 328: Multi-line Imports

One language change is a small syntactic tweak aimed at making it easier to import many names from a module. In a `from module import names` statement, names is a sequence of names separated by commas. If the sequence is very long, you can either write multiple imports from the same module, or you can use backslashes to escape the line endings like this:

    from SimpleXMLRPCServer import SimpleXMLRPCServer,\
                SimpleXMLRPCRequestHandler,\
                CGIXMLRPCRequestHandler,\
                resolve_dotted_attribute

The syntactic change in Python 2.4 simply allows putting the names within parentheses. Python ignores newlines within a parenthesized expression, so the backslashes are no longer needed:

    from SimpleXMLRPCServer import (SimpleXMLRPCServer,
                                    SimpleXMLRPCRequestHandler,
                                    CGIXMLRPCRequestHandler,
                                    resolve_dotted_attribute)

The PEP also proposes that all `import` statements be absolute imports, with a leading "`.`" character to indicate a relative import. This part of the PEP was not implemented for Python 2.4, but was completed for Python 2.5.

See Also:

PEP 328, Imports: Multi-Line and Absolute/Relative
  Written by Aahz. Multi-line imports were implemented by Dima Dorfman.