-
Notifications
You must be signed in to change notification settings - Fork 10
Import Statements
Marcos Campos edited this page Nov 2, 2017
·
2 revisions
Within a file it's generally a good idea to organize your import statements. We recommend alphabetical order. It's also good to separate import statements into the following categories and order:
- Standard library imports
- Third party imports
- Your library imports
# standard library
import os
import re
import sys
# third party library
import pymongo
from sqlalchemy import create_engine, exceptions
# personal or private library
from mymodule import MyCustomException, models, views
Example of how NOT to import packages
import sys, os # DO NOT import different modules on the same line
from sqlalchemy import * # DO NOT import *
from .models import util # DO NOT use relative imports (use fully qualified names)
COPYRIGHT © 2019-2021 CISCO SYSTEMS, INC. ALL RIGHTS RESERVED.